/* * * 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. */ // THIS FILE IS GENERATED BY ZAP #pragma once #import #include #include #include #include #include #include #include #include #include #include #include /*----------------------------------------------------------------------------*\ | Cluster Name | ID | |---------------------------------------------------------------------+--------| | Identify | 0x0003 | | Groups | 0x0004 | | OnOff | 0x0006 | | LevelControl | 0x0008 | | PulseWidthModulation | 0x001C | | Descriptor | 0x001D | | Binding | 0x001E | | AccessControl | 0x001F | | Actions | 0x0025 | | BasicInformation | 0x0028 | | OtaSoftwareUpdateProvider | 0x0029 | | OtaSoftwareUpdateRequestor | 0x002A | | LocalizationConfiguration | 0x002B | | TimeFormatLocalization | 0x002C | | UnitLocalization | 0x002D | | PowerSourceConfiguration | 0x002E | | PowerSource | 0x002F | | GeneralCommissioning | 0x0030 | | NetworkCommissioning | 0x0031 | | DiagnosticLogs | 0x0032 | | GeneralDiagnostics | 0x0033 | | SoftwareDiagnostics | 0x0034 | | ThreadNetworkDiagnostics | 0x0035 | | WiFiNetworkDiagnostics | 0x0036 | | EthernetNetworkDiagnostics | 0x0037 | | TimeSynchronization | 0x0038 | | BridgedDeviceBasicInformation | 0x0039 | | Switch | 0x003B | | AdministratorCommissioning | 0x003C | | OperationalCredentials | 0x003E | | GroupKeyManagement | 0x003F | | FixedLabel | 0x0040 | | UserLabel | 0x0041 | | ProxyConfiguration | 0x0042 | | ProxyDiscovery | 0x0043 | | ProxyValid | 0x0044 | | BooleanState | 0x0045 | | IcdManagement | 0x0046 | | Timer | 0x0047 | | OvenCavityOperationalState | 0x0048 | | OvenMode | 0x0049 | | LaundryDryerControls | 0x004A | | ModeSelect | 0x0050 | | LaundryWasherMode | 0x0051 | | RefrigeratorAndTemperatureControlledCabinetMode | 0x0052 | | LaundryWasherControls | 0x0053 | | RvcRunMode | 0x0054 | | RvcCleanMode | 0x0055 | | TemperatureControl | 0x0056 | | RefrigeratorAlarm | 0x0057 | | DishwasherMode | 0x0059 | | AirQuality | 0x005B | | SmokeCoAlarm | 0x005C | | DishwasherAlarm | 0x005D | | MicrowaveOvenMode | 0x005E | | MicrowaveOvenControl | 0x005F | | OperationalState | 0x0060 | | RvcOperationalState | 0x0061 | | ScenesManagement | 0x0062 | | HepaFilterMonitoring | 0x0071 | | ActivatedCarbonFilterMonitoring | 0x0072 | | BooleanStateConfiguration | 0x0080 | | ValveConfigurationAndControl | 0x0081 | | ElectricalPowerMeasurement | 0x0090 | | ElectricalEnergyMeasurement | 0x0091 | | WaterHeaterManagement | 0x0094 | | DemandResponseLoadControl | 0x0096 | | Messages | 0x0097 | | DeviceEnergyManagement | 0x0098 | | EnergyEvse | 0x0099 | | EnergyPreference | 0x009B | | PowerTopology | 0x009C | | EnergyEvseMode | 0x009D | | WaterHeaterMode | 0x009E | | DeviceEnergyManagementMode | 0x009F | | DoorLock | 0x0101 | | WindowCovering | 0x0102 | | ServiceArea | 0x0150 | | PumpConfigurationAndControl | 0x0200 | | Thermostat | 0x0201 | | FanControl | 0x0202 | | ThermostatUserInterfaceConfiguration | 0x0204 | | ColorControl | 0x0300 | | BallastConfiguration | 0x0301 | | IlluminanceMeasurement | 0x0400 | | TemperatureMeasurement | 0x0402 | | PressureMeasurement | 0x0403 | | FlowMeasurement | 0x0404 | | RelativeHumidityMeasurement | 0x0405 | | OccupancySensing | 0x0406 | | CarbonMonoxideConcentrationMeasurement | 0x040C | | CarbonDioxideConcentrationMeasurement | 0x040D | | NitrogenDioxideConcentrationMeasurement | 0x0413 | | OzoneConcentrationMeasurement | 0x0415 | | Pm25ConcentrationMeasurement | 0x042A | | FormaldehydeConcentrationMeasurement | 0x042B | | Pm1ConcentrationMeasurement | 0x042C | | Pm10ConcentrationMeasurement | 0x042D | | TotalVolatileOrganicCompoundsConcentrationMeasurement | 0x042E | | RadonConcentrationMeasurement | 0x042F | | WiFiNetworkManagement | 0x0451 | | ThreadBorderRouterManagement | 0x0452 | | ThreadNetworkDirectory | 0x0453 | | WakeOnLan | 0x0503 | | Channel | 0x0504 | | TargetNavigator | 0x0505 | | MediaPlayback | 0x0506 | | MediaInput | 0x0507 | | LowPower | 0x0508 | | KeypadInput | 0x0509 | | ContentLauncher | 0x050A | | AudioOutput | 0x050B | | ApplicationLauncher | 0x050C | | ApplicationBasic | 0x050D | | AccountLogin | 0x050E | | ContentControl | 0x050F | | ContentAppObserver | 0x0510 | | ZoneManagement | 0x0550 | | CameraAvStreamManagement | 0x0551 | | WebRTCTransportProvider | 0x0553 | | WebRTCTransportRequestor | 0x0554 | | Chime | 0x0556 | | EcosystemInformation | 0x0750 | | CommissionerControl | 0x0751 | | UnitTesting | 0xFFF1FC05| | FaultInjection | 0xFFF1FC06| | SampleMei | 0xFFF1FC20| \*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*\ | Cluster Identify | 0x0003 | |------------------------------------------------------------------------------| | Commands: | | | * Identify | 0x00 | | * TriggerEffect | 0x40 | |------------------------------------------------------------------------------| | Attributes: | | | * IdentifyTime | 0x0000 | | * IdentifyType | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command Identify */ class IdentifyIdentify : public ClusterCommand { public: IdentifyIdentify() : ClusterCommand("identify") { AddArgument("IdentifyTime", 0, UINT16_MAX, &mRequest.identifyTime); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Identify::Commands::Identify::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRIdentifyClusterIdentifyParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.identifyTime = [NSNumber numberWithUnsignedShort:mRequest.identifyTime]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster identifyWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Identify::Commands::Identify::Type mRequest; }; /* * Command TriggerEffect */ class IdentifyTriggerEffect : public ClusterCommand { public: IdentifyTriggerEffect() : ClusterCommand("trigger-effect") { AddArgument("EffectIdentifier", 0, UINT8_MAX, &mRequest.effectIdentifier); AddArgument("EffectVariant", 0, UINT8_MAX, &mRequest.effectVariant); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Identify::Commands::TriggerEffect::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRIdentifyClusterTriggerEffectParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.effectIdentifier = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.effectIdentifier)]; params.effectVariant = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.effectVariant)]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster triggerEffectWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Identify::Commands::TriggerEffect::Type mRequest; }; /* * Attribute IdentifyTime */ class ReadIdentifyIdentifyTime : public ReadAttribute { public: ReadIdentifyIdentifyTime() : ReadAttribute("identify-time") { } ~ReadIdentifyIdentifyTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Identify::Attributes::IdentifyTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeIdentifyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.IdentifyTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Identify IdentifyTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteIdentifyIdentifyTime : public WriteAttribute { public: WriteIdentifyIdentifyTime() : WriteAttribute("identify-time") { AddArgument("attr-name", "identify-time"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteIdentifyIdentifyTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Identify::Attributes::IdentifyTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeIdentifyTimeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Identify IdentifyTime write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeIdentifyIdentifyTime : public SubscribeAttribute { public: SubscribeAttributeIdentifyIdentifyTime() : SubscribeAttribute("identify-time") { } ~SubscribeAttributeIdentifyIdentifyTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Identify::Attributes::IdentifyTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeIdentifyTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.IdentifyTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute IdentifyType */ class ReadIdentifyIdentifyType : public ReadAttribute { public: ReadIdentifyIdentifyType() : ReadAttribute("identify-type") { } ~ReadIdentifyIdentifyType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Identify::Attributes::IdentifyType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeIdentifyTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.IdentifyType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Identify IdentifyType read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIdentifyIdentifyType : public SubscribeAttribute { public: SubscribeAttributeIdentifyIdentifyType() : SubscribeAttribute("identify-type") { } ~SubscribeAttributeIdentifyIdentifyType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Identify::Attributes::IdentifyType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeIdentifyTypeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.IdentifyType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadIdentifyGeneratedCommandList : public ReadAttribute { public: ReadIdentifyGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadIdentifyGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Identify::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Identify GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIdentifyGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeIdentifyGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeIdentifyGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Identify::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadIdentifyAcceptedCommandList : public ReadAttribute { public: ReadIdentifyAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadIdentifyAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Identify::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Identify AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIdentifyAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeIdentifyAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeIdentifyAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Identify::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadIdentifyEventList : public ReadAttribute { public: ReadIdentifyEventList() : ReadAttribute("event-list") { } ~ReadIdentifyEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Identify::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Identify EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIdentifyEventList : public SubscribeAttribute { public: SubscribeAttributeIdentifyEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeIdentifyEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Identify::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadIdentifyAttributeList : public ReadAttribute { public: ReadIdentifyAttributeList() : ReadAttribute("attribute-list") { } ~ReadIdentifyAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Identify::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Identify AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIdentifyAttributeList : public SubscribeAttribute { public: SubscribeAttributeIdentifyAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeIdentifyAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Identify::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadIdentifyFeatureMap : public ReadAttribute { public: ReadIdentifyFeatureMap() : ReadAttribute("feature-map") { } ~ReadIdentifyFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Identify::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Identify FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIdentifyFeatureMap : public SubscribeAttribute { public: SubscribeAttributeIdentifyFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeIdentifyFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Identify::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadIdentifyClusterRevision : public ReadAttribute { public: ReadIdentifyClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadIdentifyClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Identify::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Identify ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIdentifyClusterRevision : public SubscribeAttribute { public: SubscribeAttributeIdentifyClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeIdentifyClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Identify::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Identify::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster Groups | 0x0004 | |------------------------------------------------------------------------------| | Commands: | | | * AddGroup | 0x00 | | * ViewGroup | 0x01 | | * GetGroupMembership | 0x02 | | * RemoveGroup | 0x03 | | * RemoveAllGroups | 0x04 | | * AddGroupIfIdentifying | 0x05 | |------------------------------------------------------------------------------| | Attributes: | | | * NameSupport | 0x0000 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command AddGroup */ class GroupsAddGroup : public ClusterCommand { public: GroupsAddGroup() : ClusterCommand("add-group") { AddArgument("GroupID", 0, UINT16_MAX, &mRequest.groupID); AddArgument("GroupName", &mRequest.groupName); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Groups::Commands::AddGroup::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGroupsClusterAddGroupParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.groupID = [NSNumber numberWithUnsignedShort:mRequest.groupID]; params.groupName = [[NSString alloc] initWithBytes:mRequest.groupName.data() length:mRequest.groupName.size() encoding:NSUTF8StringEncoding]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster addGroupWithParams:params completion: ^(MTRGroupsClusterAddGroupResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::Groups::Commands::AddGroupResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::Groups::Commands::AddGroupResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Groups::Commands::AddGroup::Type mRequest; }; /* * Command ViewGroup */ class GroupsViewGroup : public ClusterCommand { public: GroupsViewGroup() : ClusterCommand("view-group") { AddArgument("GroupID", 0, UINT16_MAX, &mRequest.groupID); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Groups::Commands::ViewGroup::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGroupsClusterViewGroupParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.groupID = [NSNumber numberWithUnsignedShort:mRequest.groupID]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster viewGroupWithParams:params completion: ^(MTRGroupsClusterViewGroupResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::Groups::Commands::ViewGroupResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::Groups::Commands::ViewGroupResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Groups::Commands::ViewGroup::Type mRequest; }; /* * Command GetGroupMembership */ class GroupsGetGroupMembership : public ClusterCommand { public: GroupsGetGroupMembership() : ClusterCommand("get-group-membership") , mComplex_GroupList(&mRequest.groupList) { AddArgument("GroupList", &mComplex_GroupList); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Groups::Commands::GetGroupMembership::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGroupsClusterGetGroupMembershipParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.groupList) { NSNumber * newElement_0; newElement_0 = [NSNumber numberWithUnsignedShort:entry_0]; [array_0 addObject:newElement_0]; } params.groupList = array_0; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster getGroupMembershipWithParams:params completion: ^(MTRGroupsClusterGetGroupMembershipResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::Groups::Commands::GetGroupMembershipResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::Groups::Commands::GetGroupMembershipResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Groups::Commands::GetGroupMembership::Type mRequest; TypedComplexArgument> mComplex_GroupList; }; /* * Command RemoveGroup */ class GroupsRemoveGroup : public ClusterCommand { public: GroupsRemoveGroup() : ClusterCommand("remove-group") { AddArgument("GroupID", 0, UINT16_MAX, &mRequest.groupID); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Groups::Commands::RemoveGroup::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGroupsClusterRemoveGroupParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.groupID = [NSNumber numberWithUnsignedShort:mRequest.groupID]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster removeGroupWithParams:params completion: ^(MTRGroupsClusterRemoveGroupResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::Groups::Commands::RemoveGroupResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::Groups::Commands::RemoveGroupResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Groups::Commands::RemoveGroup::Type mRequest; }; /* * Command RemoveAllGroups */ class GroupsRemoveAllGroups : public ClusterCommand { public: GroupsRemoveAllGroups() : ClusterCommand("remove-all-groups") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Groups::Commands::RemoveAllGroups::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGroupsClusterRemoveAllGroupsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster removeAllGroupsWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command AddGroupIfIdentifying */ class GroupsAddGroupIfIdentifying : public ClusterCommand { public: GroupsAddGroupIfIdentifying() : ClusterCommand("add-group-if-identifying") { AddArgument("GroupID", 0, UINT16_MAX, &mRequest.groupID); AddArgument("GroupName", &mRequest.groupName); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Groups::Commands::AddGroupIfIdentifying::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGroupsClusterAddGroupIfIdentifyingParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.groupID = [NSNumber numberWithUnsignedShort:mRequest.groupID]; params.groupName = [[NSString alloc] initWithBytes:mRequest.groupName.data() length:mRequest.groupName.size() encoding:NSUTF8StringEncoding]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster addGroupIfIdentifyingWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Groups::Commands::AddGroupIfIdentifying::Type mRequest; }; /* * Attribute NameSupport */ class ReadGroupsNameSupport : public ReadAttribute { public: ReadGroupsNameSupport() : ReadAttribute("name-support") { } ~ReadGroupsNameSupport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Groups::Attributes::NameSupport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNameSupportWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.NameSupport response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Groups NameSupport read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGroupsNameSupport : public SubscribeAttribute { public: SubscribeAttributeGroupsNameSupport() : SubscribeAttribute("name-support") { } ~SubscribeAttributeGroupsNameSupport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Groups::Attributes::NameSupport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNameSupportWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.NameSupport response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadGroupsGeneratedCommandList : public ReadAttribute { public: ReadGroupsGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadGroupsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Groups::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Groups GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGroupsGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeGroupsGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeGroupsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Groups::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadGroupsAcceptedCommandList : public ReadAttribute { public: ReadGroupsAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadGroupsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Groups::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Groups AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGroupsAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeGroupsAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeGroupsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Groups::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadGroupsEventList : public ReadAttribute { public: ReadGroupsEventList() : ReadAttribute("event-list") { } ~ReadGroupsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Groups::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Groups EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGroupsEventList : public SubscribeAttribute { public: SubscribeAttributeGroupsEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeGroupsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Groups::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadGroupsAttributeList : public ReadAttribute { public: ReadGroupsAttributeList() : ReadAttribute("attribute-list") { } ~ReadGroupsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Groups::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Groups AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGroupsAttributeList : public SubscribeAttribute { public: SubscribeAttributeGroupsAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeGroupsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Groups::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadGroupsFeatureMap : public ReadAttribute { public: ReadGroupsFeatureMap() : ReadAttribute("feature-map") { } ~ReadGroupsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Groups::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Groups FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGroupsFeatureMap : public SubscribeAttribute { public: SubscribeAttributeGroupsFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeGroupsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Groups::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadGroupsClusterRevision : public ReadAttribute { public: ReadGroupsClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadGroupsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Groups::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Groups ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGroupsClusterRevision : public SubscribeAttribute { public: SubscribeAttributeGroupsClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeGroupsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Groups::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Groups::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster OnOff | 0x0006 | |------------------------------------------------------------------------------| | Commands: | | | * Off | 0x00 | | * On | 0x01 | | * Toggle | 0x02 | | * OffWithEffect | 0x40 | | * OnWithRecallGlobalScene | 0x41 | | * OnWithTimedOff | 0x42 | |------------------------------------------------------------------------------| | Attributes: | | | * OnOff | 0x0000 | | * GlobalSceneControl | 0x4000 | | * OnTime | 0x4001 | | * OffWaitTime | 0x4002 | | * StartUpOnOff | 0x4003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command Off */ class OnOffOff : public ClusterCommand { public: OnOffOff() : ClusterCommand("off") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OnOff::Commands::Off::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROnOffClusterOffParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster offWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command On */ class OnOffOn : public ClusterCommand { public: OnOffOn() : ClusterCommand("on") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OnOff::Commands::On::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROnOffClusterOnParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster onWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command Toggle */ class OnOffToggle : public ClusterCommand { public: OnOffToggle() : ClusterCommand("toggle") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OnOff::Commands::Toggle::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROnOffClusterToggleParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster toggleWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command OffWithEffect */ class OnOffOffWithEffect : public ClusterCommand { public: OnOffOffWithEffect() : ClusterCommand("off-with-effect") { AddArgument("EffectIdentifier", 0, UINT8_MAX, &mRequest.effectIdentifier); AddArgument("EffectVariant", 0, UINT8_MAX, &mRequest.effectVariant); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OnOff::Commands::OffWithEffect::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROnOffClusterOffWithEffectParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.effectIdentifier = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.effectIdentifier)]; params.effectVariant = [NSNumber numberWithUnsignedChar:mRequest.effectVariant]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster offWithEffectWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::OnOff::Commands::OffWithEffect::Type mRequest; }; /* * Command OnWithRecallGlobalScene */ class OnOffOnWithRecallGlobalScene : public ClusterCommand { public: OnOffOnWithRecallGlobalScene() : ClusterCommand("on-with-recall-global-scene") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OnOff::Commands::OnWithRecallGlobalScene::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROnOffClusterOnWithRecallGlobalSceneParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster onWithRecallGlobalSceneWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command OnWithTimedOff */ class OnOffOnWithTimedOff : public ClusterCommand { public: OnOffOnWithTimedOff() : ClusterCommand("on-with-timed-off") { AddArgument("OnOffControl", 0, UINT8_MAX, &mRequest.onOffControl); AddArgument("OnTime", 0, UINT16_MAX, &mRequest.onTime); AddArgument("OffWaitTime", 0, UINT16_MAX, &mRequest.offWaitTime); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROnOffClusterOnWithTimedOffParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.onOffControl = [NSNumber numberWithUnsignedChar:mRequest.onOffControl.Raw()]; params.onTime = [NSNumber numberWithUnsignedShort:mRequest.onTime]; params.offWaitTime = [NSNumber numberWithUnsignedShort:mRequest.offWaitTime]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster onWithTimedOffWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::OnOff::Commands::OnWithTimedOff::Type mRequest; }; /* * Attribute OnOff */ class ReadOnOffOnOff : public ReadAttribute { public: ReadOnOffOnOff() : ReadAttribute("on-off") { } ~ReadOnOffOnOff() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OnOff::Attributes::OnOff::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOnOffWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.OnOff response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OnOff OnOff read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOnOffOnOff : public SubscribeAttribute { public: SubscribeAttributeOnOffOnOff() : SubscribeAttribute("on-off") { } ~SubscribeAttributeOnOffOnOff() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OnOff::Attributes::OnOff::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOnOffWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.OnOff response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GlobalSceneControl */ class ReadOnOffGlobalSceneControl : public ReadAttribute { public: ReadOnOffGlobalSceneControl() : ReadAttribute("global-scene-control") { } ~ReadOnOffGlobalSceneControl() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OnOff::Attributes::GlobalSceneControl::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGlobalSceneControlWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.GlobalSceneControl response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OnOff GlobalSceneControl read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOnOffGlobalSceneControl : public SubscribeAttribute { public: SubscribeAttributeOnOffGlobalSceneControl() : SubscribeAttribute("global-scene-control") { } ~SubscribeAttributeOnOffGlobalSceneControl() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OnOff::Attributes::GlobalSceneControl::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGlobalSceneControlWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.GlobalSceneControl response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OnTime */ class ReadOnOffOnTime : public ReadAttribute { public: ReadOnOffOnTime() : ReadAttribute("on-time") { } ~ReadOnOffOnTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OnOff::Attributes::OnTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOnTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.OnTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OnOff OnTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteOnOffOnTime : public WriteAttribute { public: WriteOnOffOnTime() : WriteAttribute("on-time") { AddArgument("attr-name", "on-time"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteOnOffOnTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OnOff::Attributes::OnTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeOnTimeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("OnOff OnTime write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeOnOffOnTime : public SubscribeAttribute { public: SubscribeAttributeOnOffOnTime() : SubscribeAttribute("on-time") { } ~SubscribeAttributeOnOffOnTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OnOff::Attributes::OnTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOnTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.OnTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OffWaitTime */ class ReadOnOffOffWaitTime : public ReadAttribute { public: ReadOnOffOffWaitTime() : ReadAttribute("off-wait-time") { } ~ReadOnOffOffWaitTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OnOff::Attributes::OffWaitTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOffWaitTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.OffWaitTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OnOff OffWaitTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteOnOffOffWaitTime : public WriteAttribute { public: WriteOnOffOffWaitTime() : WriteAttribute("off-wait-time") { AddArgument("attr-name", "off-wait-time"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteOnOffOffWaitTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OnOff::Attributes::OffWaitTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeOffWaitTimeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("OnOff OffWaitTime write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeOnOffOffWaitTime : public SubscribeAttribute { public: SubscribeAttributeOnOffOffWaitTime() : SubscribeAttribute("off-wait-time") { } ~SubscribeAttributeOnOffOffWaitTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OnOff::Attributes::OffWaitTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOffWaitTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.OffWaitTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute StartUpOnOff */ class ReadOnOffStartUpOnOff : public ReadAttribute { public: ReadOnOffStartUpOnOff() : ReadAttribute("start-up-on-off") { } ~ReadOnOffStartUpOnOff() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OnOff::Attributes::StartUpOnOff::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStartUpOnOffWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.StartUpOnOff response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OnOff StartUpOnOff read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteOnOffStartUpOnOff : public WriteAttribute { public: WriteOnOffStartUpOnOff() : WriteAttribute("start-up-on-off") { AddArgument("attr-name", "start-up-on-off"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteOnOffStartUpOnOff() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OnOff::Attributes::StartUpOnOff::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeStartUpOnOffWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("OnOff StartUpOnOff write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeOnOffStartUpOnOff : public SubscribeAttribute { public: SubscribeAttributeOnOffStartUpOnOff() : SubscribeAttribute("start-up-on-off") { } ~SubscribeAttributeOnOffStartUpOnOff() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OnOff::Attributes::StartUpOnOff::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStartUpOnOffWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.StartUpOnOff response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadOnOffGeneratedCommandList : public ReadAttribute { public: ReadOnOffGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadOnOffGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OnOff::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OnOff GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOnOffGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeOnOffGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeOnOffGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OnOff::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadOnOffAcceptedCommandList : public ReadAttribute { public: ReadOnOffAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadOnOffAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OnOff::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OnOff AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOnOffAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeOnOffAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeOnOffAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OnOff::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadOnOffEventList : public ReadAttribute { public: ReadOnOffEventList() : ReadAttribute("event-list") { } ~ReadOnOffEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OnOff::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OnOff EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOnOffEventList : public SubscribeAttribute { public: SubscribeAttributeOnOffEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeOnOffEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OnOff::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadOnOffAttributeList : public ReadAttribute { public: ReadOnOffAttributeList() : ReadAttribute("attribute-list") { } ~ReadOnOffAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OnOff::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OnOff AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOnOffAttributeList : public SubscribeAttribute { public: SubscribeAttributeOnOffAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeOnOffAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OnOff::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadOnOffFeatureMap : public ReadAttribute { public: ReadOnOffFeatureMap() : ReadAttribute("feature-map") { } ~ReadOnOffFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OnOff::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OnOff FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOnOffFeatureMap : public SubscribeAttribute { public: SubscribeAttributeOnOffFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeOnOffFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OnOff::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadOnOffClusterRevision : public ReadAttribute { public: ReadOnOffClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadOnOffClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OnOff::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OnOff ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOnOffClusterRevision : public SubscribeAttribute { public: SubscribeAttributeOnOffClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeOnOffClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OnOff::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OnOff::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster LevelControl | 0x0008 | |------------------------------------------------------------------------------| | Commands: | | | * MoveToLevel | 0x00 | | * Move | 0x01 | | * Step | 0x02 | | * Stop | 0x03 | | * MoveToLevelWithOnOff | 0x04 | | * MoveWithOnOff | 0x05 | | * StepWithOnOff | 0x06 | | * StopWithOnOff | 0x07 | | * MoveToClosestFrequency | 0x08 | |------------------------------------------------------------------------------| | Attributes: | | | * CurrentLevel | 0x0000 | | * RemainingTime | 0x0001 | | * MinLevel | 0x0002 | | * MaxLevel | 0x0003 | | * CurrentFrequency | 0x0004 | | * MinFrequency | 0x0005 | | * MaxFrequency | 0x0006 | | * Options | 0x000F | | * OnOffTransitionTime | 0x0010 | | * OnLevel | 0x0011 | | * OnTransitionTime | 0x0012 | | * OffTransitionTime | 0x0013 | | * DefaultMoveRate | 0x0014 | | * StartUpCurrentLevel | 0x4000 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command MoveToLevel */ class LevelControlMoveToLevel : public ClusterCommand { public: LevelControlMoveToLevel() : ClusterCommand("move-to-level") { AddArgument("Level", 0, UINT8_MAX, &mRequest.level); AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRLevelControlClusterMoveToLevelParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.level = [NSNumber numberWithUnsignedChar:mRequest.level]; if (mRequest.transitionTime.IsNull()) { params.transitionTime = nil; } else { params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime.Value()]; } params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster moveToLevelWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type mRequest; }; /* * Command Move */ class LevelControlMove : public ClusterCommand { public: LevelControlMove() : ClusterCommand("move") { AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); AddArgument("Rate", 0, UINT8_MAX, &mRequest.rate); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::LevelControl::Commands::Move::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRLevelControlClusterMoveParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.moveMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; if (mRequest.rate.IsNull()) { params.rate = nil; } else { params.rate = [NSNumber numberWithUnsignedChar:mRequest.rate.Value()]; } params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster moveWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::LevelControl::Commands::Move::Type mRequest; }; /* * Command Step */ class LevelControlStep : public ClusterCommand { public: LevelControlStep() : ClusterCommand("step") { AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); AddArgument("StepSize", 0, UINT8_MAX, &mRequest.stepSize); AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::LevelControl::Commands::Step::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRLevelControlClusterStepParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.stepMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; params.stepSize = [NSNumber numberWithUnsignedChar:mRequest.stepSize]; if (mRequest.transitionTime.IsNull()) { params.transitionTime = nil; } else { params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime.Value()]; } params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stepWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::LevelControl::Commands::Step::Type mRequest; }; /* * Command Stop */ class LevelControlStop : public ClusterCommand { public: LevelControlStop() : ClusterCommand("stop") { AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::LevelControl::Commands::Stop::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRLevelControlClusterStopParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stopWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::LevelControl::Commands::Stop::Type mRequest; }; /* * Command MoveToLevelWithOnOff */ class LevelControlMoveToLevelWithOnOff : public ClusterCommand { public: LevelControlMoveToLevelWithOnOff() : ClusterCommand("move-to-level-with-on-off") { AddArgument("Level", 0, UINT8_MAX, &mRequest.level); AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::LevelControl::Commands::MoveToLevelWithOnOff::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRLevelControlClusterMoveToLevelWithOnOffParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.level = [NSNumber numberWithUnsignedChar:mRequest.level]; if (mRequest.transitionTime.IsNull()) { params.transitionTime = nil; } else { params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime.Value()]; } params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster moveToLevelWithOnOffWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::LevelControl::Commands::MoveToLevelWithOnOff::Type mRequest; }; /* * Command MoveWithOnOff */ class LevelControlMoveWithOnOff : public ClusterCommand { public: LevelControlMoveWithOnOff() : ClusterCommand("move-with-on-off") { AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); AddArgument("Rate", 0, UINT8_MAX, &mRequest.rate); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::LevelControl::Commands::MoveWithOnOff::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRLevelControlClusterMoveWithOnOffParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.moveMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; if (mRequest.rate.IsNull()) { params.rate = nil; } else { params.rate = [NSNumber numberWithUnsignedChar:mRequest.rate.Value()]; } params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster moveWithOnOffWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::LevelControl::Commands::MoveWithOnOff::Type mRequest; }; /* * Command StepWithOnOff */ class LevelControlStepWithOnOff : public ClusterCommand { public: LevelControlStepWithOnOff() : ClusterCommand("step-with-on-off") { AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); AddArgument("StepSize", 0, UINT8_MAX, &mRequest.stepSize); AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::LevelControl::Commands::StepWithOnOff::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRLevelControlClusterStepWithOnOffParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.stepMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; params.stepSize = [NSNumber numberWithUnsignedChar:mRequest.stepSize]; if (mRequest.transitionTime.IsNull()) { params.transitionTime = nil; } else { params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime.Value()]; } params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stepWithOnOffWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::LevelControl::Commands::StepWithOnOff::Type mRequest; }; /* * Command StopWithOnOff */ class LevelControlStopWithOnOff : public ClusterCommand { public: LevelControlStopWithOnOff() : ClusterCommand("stop-with-on-off") { AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::LevelControl::Commands::StopWithOnOff::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRLevelControlClusterStopWithOnOffParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stopWithOnOffWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::LevelControl::Commands::StopWithOnOff::Type mRequest; }; /* * Command MoveToClosestFrequency */ class LevelControlMoveToClosestFrequency : public ClusterCommand { public: LevelControlMoveToClosestFrequency() : ClusterCommand("move-to-closest-frequency") { AddArgument("Frequency", 0, UINT16_MAX, &mRequest.frequency); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::LevelControl::Commands::MoveToClosestFrequency::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRLevelControlClusterMoveToClosestFrequencyParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.frequency = [NSNumber numberWithUnsignedShort:mRequest.frequency]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster moveToClosestFrequencyWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::LevelControl::Commands::MoveToClosestFrequency::Type mRequest; }; /* * Attribute CurrentLevel */ class ReadLevelControlCurrentLevel : public ReadAttribute { public: ReadLevelControlCurrentLevel() : ReadAttribute("current-level") { } ~ReadLevelControlCurrentLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::CurrentLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.CurrentLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl CurrentLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLevelControlCurrentLevel : public SubscribeAttribute { public: SubscribeAttributeLevelControlCurrentLevel() : SubscribeAttribute("current-level") { } ~SubscribeAttributeLevelControlCurrentLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::CurrentLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.CurrentLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RemainingTime */ class ReadLevelControlRemainingTime : public ReadAttribute { public: ReadLevelControlRemainingTime() : ReadAttribute("remaining-time") { } ~ReadLevelControlRemainingTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::RemainingTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRemainingTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.RemainingTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl RemainingTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLevelControlRemainingTime : public SubscribeAttribute { public: SubscribeAttributeLevelControlRemainingTime() : SubscribeAttribute("remaining-time") { } ~SubscribeAttributeLevelControlRemainingTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::RemainingTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRemainingTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.RemainingTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinLevel */ class ReadLevelControlMinLevel : public ReadAttribute { public: ReadLevelControlMinLevel() : ReadAttribute("min-level") { } ~ReadLevelControlMinLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::MinLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.MinLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl MinLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLevelControlMinLevel : public SubscribeAttribute { public: SubscribeAttributeLevelControlMinLevel() : SubscribeAttribute("min-level") { } ~SubscribeAttributeLevelControlMinLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::MinLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.MinLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxLevel */ class ReadLevelControlMaxLevel : public ReadAttribute { public: ReadLevelControlMaxLevel() : ReadAttribute("max-level") { } ~ReadLevelControlMaxLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::MaxLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.MaxLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl MaxLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLevelControlMaxLevel : public SubscribeAttribute { public: SubscribeAttributeLevelControlMaxLevel() : SubscribeAttribute("max-level") { } ~SubscribeAttributeLevelControlMaxLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::MaxLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.MaxLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentFrequency */ class ReadLevelControlCurrentFrequency : public ReadAttribute { public: ReadLevelControlCurrentFrequency() : ReadAttribute("current-frequency") { } ~ReadLevelControlCurrentFrequency() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::CurrentFrequency::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.CurrentFrequency response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl CurrentFrequency read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLevelControlCurrentFrequency : public SubscribeAttribute { public: SubscribeAttributeLevelControlCurrentFrequency() : SubscribeAttribute("current-frequency") { } ~SubscribeAttributeLevelControlCurrentFrequency() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::CurrentFrequency::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentFrequencyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.CurrentFrequency response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinFrequency */ class ReadLevelControlMinFrequency : public ReadAttribute { public: ReadLevelControlMinFrequency() : ReadAttribute("min-frequency") { } ~ReadLevelControlMinFrequency() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::MinFrequency::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.MinFrequency response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl MinFrequency read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLevelControlMinFrequency : public SubscribeAttribute { public: SubscribeAttributeLevelControlMinFrequency() : SubscribeAttribute("min-frequency") { } ~SubscribeAttributeLevelControlMinFrequency() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::MinFrequency::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinFrequencyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.MinFrequency response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxFrequency */ class ReadLevelControlMaxFrequency : public ReadAttribute { public: ReadLevelControlMaxFrequency() : ReadAttribute("max-frequency") { } ~ReadLevelControlMaxFrequency() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::MaxFrequency::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.MaxFrequency response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl MaxFrequency read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLevelControlMaxFrequency : public SubscribeAttribute { public: SubscribeAttributeLevelControlMaxFrequency() : SubscribeAttribute("max-frequency") { } ~SubscribeAttributeLevelControlMaxFrequency() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::MaxFrequency::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxFrequencyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.MaxFrequency response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Options */ class ReadLevelControlOptions : public ReadAttribute { public: ReadLevelControlOptions() : ReadAttribute("options") { } ~ReadLevelControlOptions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::Options::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOptionsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.Options response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl Options read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteLevelControlOptions : public WriteAttribute { public: WriteLevelControlOptions() : WriteAttribute("options") { AddArgument("attr-name", "options"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteLevelControlOptions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::Options::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeOptionsWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("LevelControl Options write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeLevelControlOptions : public SubscribeAttribute { public: SubscribeAttributeLevelControlOptions() : SubscribeAttribute("options") { } ~SubscribeAttributeLevelControlOptions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::Options::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOptionsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.Options response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OnOffTransitionTime */ class ReadLevelControlOnOffTransitionTime : public ReadAttribute { public: ReadLevelControlOnOffTransitionTime() : ReadAttribute("on-off-transition-time") { } ~ReadLevelControlOnOffTransitionTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::OnOffTransitionTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOnOffTransitionTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.OnOffTransitionTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl OnOffTransitionTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteLevelControlOnOffTransitionTime : public WriteAttribute { public: WriteLevelControlOnOffTransitionTime() : WriteAttribute("on-off-transition-time") { AddArgument("attr-name", "on-off-transition-time"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteLevelControlOnOffTransitionTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::OnOffTransitionTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeOnOffTransitionTimeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("LevelControl OnOffTransitionTime write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeLevelControlOnOffTransitionTime : public SubscribeAttribute { public: SubscribeAttributeLevelControlOnOffTransitionTime() : SubscribeAttribute("on-off-transition-time") { } ~SubscribeAttributeLevelControlOnOffTransitionTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::OnOffTransitionTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOnOffTransitionTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.OnOffTransitionTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OnLevel */ class ReadLevelControlOnLevel : public ReadAttribute { public: ReadLevelControlOnLevel() : ReadAttribute("on-level") { } ~ReadLevelControlOnLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::OnLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOnLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.OnLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl OnLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteLevelControlOnLevel : public WriteAttribute { public: WriteLevelControlOnLevel() : WriteAttribute("on-level") { AddArgument("attr-name", "on-level"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteLevelControlOnLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::OnLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeOnLevelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("LevelControl OnLevel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeLevelControlOnLevel : public SubscribeAttribute { public: SubscribeAttributeLevelControlOnLevel() : SubscribeAttribute("on-level") { } ~SubscribeAttributeLevelControlOnLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::OnLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOnLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.OnLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OnTransitionTime */ class ReadLevelControlOnTransitionTime : public ReadAttribute { public: ReadLevelControlOnTransitionTime() : ReadAttribute("on-transition-time") { } ~ReadLevelControlOnTransitionTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::OnTransitionTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOnTransitionTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.OnTransitionTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl OnTransitionTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteLevelControlOnTransitionTime : public WriteAttribute { public: WriteLevelControlOnTransitionTime() : WriteAttribute("on-transition-time") { AddArgument("attr-name", "on-transition-time"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteLevelControlOnTransitionTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::OnTransitionTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedShort:mValue.Value()]; } [cluster writeAttributeOnTransitionTimeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("LevelControl OnTransitionTime write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeLevelControlOnTransitionTime : public SubscribeAttribute { public: SubscribeAttributeLevelControlOnTransitionTime() : SubscribeAttribute("on-transition-time") { } ~SubscribeAttributeLevelControlOnTransitionTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::OnTransitionTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOnTransitionTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.OnTransitionTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OffTransitionTime */ class ReadLevelControlOffTransitionTime : public ReadAttribute { public: ReadLevelControlOffTransitionTime() : ReadAttribute("off-transition-time") { } ~ReadLevelControlOffTransitionTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::OffTransitionTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOffTransitionTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.OffTransitionTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl OffTransitionTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteLevelControlOffTransitionTime : public WriteAttribute { public: WriteLevelControlOffTransitionTime() : WriteAttribute("off-transition-time") { AddArgument("attr-name", "off-transition-time"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteLevelControlOffTransitionTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::OffTransitionTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedShort:mValue.Value()]; } [cluster writeAttributeOffTransitionTimeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("LevelControl OffTransitionTime write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeLevelControlOffTransitionTime : public SubscribeAttribute { public: SubscribeAttributeLevelControlOffTransitionTime() : SubscribeAttribute("off-transition-time") { } ~SubscribeAttributeLevelControlOffTransitionTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::OffTransitionTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOffTransitionTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.OffTransitionTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute DefaultMoveRate */ class ReadLevelControlDefaultMoveRate : public ReadAttribute { public: ReadLevelControlDefaultMoveRate() : ReadAttribute("default-move-rate") { } ~ReadLevelControlDefaultMoveRate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::DefaultMoveRate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDefaultMoveRateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.DefaultMoveRate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl DefaultMoveRate read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteLevelControlDefaultMoveRate : public WriteAttribute { public: WriteLevelControlDefaultMoveRate() : WriteAttribute("default-move-rate") { AddArgument("attr-name", "default-move-rate"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteLevelControlDefaultMoveRate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::DefaultMoveRate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeDefaultMoveRateWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("LevelControl DefaultMoveRate write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeLevelControlDefaultMoveRate : public SubscribeAttribute { public: SubscribeAttributeLevelControlDefaultMoveRate() : SubscribeAttribute("default-move-rate") { } ~SubscribeAttributeLevelControlDefaultMoveRate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::DefaultMoveRate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDefaultMoveRateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.DefaultMoveRate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute StartUpCurrentLevel */ class ReadLevelControlStartUpCurrentLevel : public ReadAttribute { public: ReadLevelControlStartUpCurrentLevel() : ReadAttribute("start-up-current-level") { } ~ReadLevelControlStartUpCurrentLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::StartUpCurrentLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStartUpCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.StartUpCurrentLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl StartUpCurrentLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteLevelControlStartUpCurrentLevel : public WriteAttribute { public: WriteLevelControlStartUpCurrentLevel() : WriteAttribute("start-up-current-level") { AddArgument("attr-name", "start-up-current-level"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteLevelControlStartUpCurrentLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::StartUpCurrentLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeStartUpCurrentLevelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("LevelControl StartUpCurrentLevel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeLevelControlStartUpCurrentLevel : public SubscribeAttribute { public: SubscribeAttributeLevelControlStartUpCurrentLevel() : SubscribeAttribute("start-up-current-level") { } ~SubscribeAttributeLevelControlStartUpCurrentLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::StartUpCurrentLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStartUpCurrentLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.StartUpCurrentLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadLevelControlGeneratedCommandList : public ReadAttribute { public: ReadLevelControlGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadLevelControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLevelControlGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeLevelControlGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeLevelControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadLevelControlAcceptedCommandList : public ReadAttribute { public: ReadLevelControlAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadLevelControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLevelControlAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeLevelControlAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeLevelControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadLevelControlEventList : public ReadAttribute { public: ReadLevelControlEventList() : ReadAttribute("event-list") { } ~ReadLevelControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLevelControlEventList : public SubscribeAttribute { public: SubscribeAttributeLevelControlEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeLevelControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadLevelControlAttributeList : public ReadAttribute { public: ReadLevelControlAttributeList() : ReadAttribute("attribute-list") { } ~ReadLevelControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLevelControlAttributeList : public SubscribeAttribute { public: SubscribeAttributeLevelControlAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeLevelControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadLevelControlFeatureMap : public ReadAttribute { public: ReadLevelControlFeatureMap() : ReadAttribute("feature-map") { } ~ReadLevelControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLevelControlFeatureMap : public SubscribeAttribute { public: SubscribeAttributeLevelControlFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeLevelControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadLevelControlClusterRevision : public ReadAttribute { public: ReadLevelControlClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadLevelControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LevelControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LevelControl ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLevelControlClusterRevision : public SubscribeAttribute { public: SubscribeAttributeLevelControlClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeLevelControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LevelControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LevelControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster PulseWidthModulation | 0x001C | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadPulseWidthModulationGeneratedCommandList : public ReadAttribute { public: ReadPulseWidthModulationGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadPulseWidthModulationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PulseWidthModulation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PulseWidthModulation::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPulseWidthModulation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PulseWidthModulation.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PulseWidthModulation GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePulseWidthModulationGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributePulseWidthModulationGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributePulseWidthModulationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PulseWidthModulation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PulseWidthModulation::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPulseWidthModulation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PulseWidthModulation.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadPulseWidthModulationAcceptedCommandList : public ReadAttribute { public: ReadPulseWidthModulationAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadPulseWidthModulationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PulseWidthModulation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PulseWidthModulation::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPulseWidthModulation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PulseWidthModulation.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PulseWidthModulation AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePulseWidthModulationAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributePulseWidthModulationAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributePulseWidthModulationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PulseWidthModulation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PulseWidthModulation::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPulseWidthModulation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PulseWidthModulation.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadPulseWidthModulationEventList : public ReadAttribute { public: ReadPulseWidthModulationEventList() : ReadAttribute("event-list") { } ~ReadPulseWidthModulationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PulseWidthModulation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PulseWidthModulation::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPulseWidthModulation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PulseWidthModulation.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PulseWidthModulation EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePulseWidthModulationEventList : public SubscribeAttribute { public: SubscribeAttributePulseWidthModulationEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributePulseWidthModulationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PulseWidthModulation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PulseWidthModulation::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPulseWidthModulation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PulseWidthModulation.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadPulseWidthModulationAttributeList : public ReadAttribute { public: ReadPulseWidthModulationAttributeList() : ReadAttribute("attribute-list") { } ~ReadPulseWidthModulationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PulseWidthModulation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PulseWidthModulation::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPulseWidthModulation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PulseWidthModulation.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PulseWidthModulation AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePulseWidthModulationAttributeList : public SubscribeAttribute { public: SubscribeAttributePulseWidthModulationAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributePulseWidthModulationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PulseWidthModulation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PulseWidthModulation::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPulseWidthModulation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PulseWidthModulation.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadPulseWidthModulationFeatureMap : public ReadAttribute { public: ReadPulseWidthModulationFeatureMap() : ReadAttribute("feature-map") { } ~ReadPulseWidthModulationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PulseWidthModulation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PulseWidthModulation::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPulseWidthModulation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PulseWidthModulation.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PulseWidthModulation FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePulseWidthModulationFeatureMap : public SubscribeAttribute { public: SubscribeAttributePulseWidthModulationFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributePulseWidthModulationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PulseWidthModulation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PulseWidthModulation::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPulseWidthModulation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PulseWidthModulation.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadPulseWidthModulationClusterRevision : public ReadAttribute { public: ReadPulseWidthModulationClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadPulseWidthModulationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PulseWidthModulation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PulseWidthModulation::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPulseWidthModulation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PulseWidthModulation.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PulseWidthModulation ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePulseWidthModulationClusterRevision : public SubscribeAttribute { public: SubscribeAttributePulseWidthModulationClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributePulseWidthModulationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PulseWidthModulation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PulseWidthModulation::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPulseWidthModulation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PulseWidthModulation.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster Descriptor | 0x001D | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * DeviceTypeList | 0x0000 | | * ServerList | 0x0001 | | * ClientList | 0x0002 | | * PartsList | 0x0003 | | * TagList | 0x0004 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute DeviceTypeList */ class ReadDescriptorDeviceTypeList : public ReadAttribute { public: ReadDescriptorDeviceTypeList() : ReadAttribute("device-type-list") { } ~ReadDescriptorDeviceTypeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Descriptor::Attributes::DeviceTypeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDeviceTypeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.DeviceTypeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Descriptor DeviceTypeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDescriptorDeviceTypeList : public SubscribeAttribute { public: SubscribeAttributeDescriptorDeviceTypeList() : SubscribeAttribute("device-type-list") { } ~SubscribeAttributeDescriptorDeviceTypeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Descriptor::Attributes::DeviceTypeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDeviceTypeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.DeviceTypeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ServerList */ class ReadDescriptorServerList : public ReadAttribute { public: ReadDescriptorServerList() : ReadAttribute("server-list") { } ~ReadDescriptorServerList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Descriptor::Attributes::ServerList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeServerListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.ServerList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Descriptor ServerList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDescriptorServerList : public SubscribeAttribute { public: SubscribeAttributeDescriptorServerList() : SubscribeAttribute("server-list") { } ~SubscribeAttributeDescriptorServerList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Descriptor::Attributes::ServerList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeServerListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.ServerList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClientList */ class ReadDescriptorClientList : public ReadAttribute { public: ReadDescriptorClientList() : ReadAttribute("client-list") { } ~ReadDescriptorClientList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Descriptor::Attributes::ClientList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClientListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.ClientList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Descriptor ClientList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDescriptorClientList : public SubscribeAttribute { public: SubscribeAttributeDescriptorClientList() : SubscribeAttribute("client-list") { } ~SubscribeAttributeDescriptorClientList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Descriptor::Attributes::ClientList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClientListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.ClientList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PartsList */ class ReadDescriptorPartsList : public ReadAttribute { public: ReadDescriptorPartsList() : ReadAttribute("parts-list") { } ~ReadDescriptorPartsList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Descriptor::Attributes::PartsList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePartsListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.PartsList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Descriptor PartsList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDescriptorPartsList : public SubscribeAttribute { public: SubscribeAttributeDescriptorPartsList() : SubscribeAttribute("parts-list") { } ~SubscribeAttributeDescriptorPartsList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Descriptor::Attributes::PartsList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePartsListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.PartsList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute TagList */ class ReadDescriptorTagList : public ReadAttribute { public: ReadDescriptorTagList() : ReadAttribute("tag-list") { } ~ReadDescriptorTagList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Descriptor::Attributes::TagList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTagListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.TagList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Descriptor TagList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDescriptorTagList : public SubscribeAttribute { public: SubscribeAttributeDescriptorTagList() : SubscribeAttribute("tag-list") { } ~SubscribeAttributeDescriptorTagList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Descriptor::Attributes::TagList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTagListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.TagList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadDescriptorGeneratedCommandList : public ReadAttribute { public: ReadDescriptorGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadDescriptorGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Descriptor::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Descriptor GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDescriptorGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeDescriptorGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeDescriptorGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Descriptor::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadDescriptorAcceptedCommandList : public ReadAttribute { public: ReadDescriptorAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadDescriptorAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Descriptor::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Descriptor AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDescriptorAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeDescriptorAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeDescriptorAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Descriptor::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadDescriptorEventList : public ReadAttribute { public: ReadDescriptorEventList() : ReadAttribute("event-list") { } ~ReadDescriptorEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Descriptor::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Descriptor EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDescriptorEventList : public SubscribeAttribute { public: SubscribeAttributeDescriptorEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeDescriptorEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Descriptor::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadDescriptorAttributeList : public ReadAttribute { public: ReadDescriptorAttributeList() : ReadAttribute("attribute-list") { } ~ReadDescriptorAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Descriptor::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Descriptor AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDescriptorAttributeList : public SubscribeAttribute { public: SubscribeAttributeDescriptorAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeDescriptorAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Descriptor::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadDescriptorFeatureMap : public ReadAttribute { public: ReadDescriptorFeatureMap() : ReadAttribute("feature-map") { } ~ReadDescriptorFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Descriptor::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Descriptor FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDescriptorFeatureMap : public SubscribeAttribute { public: SubscribeAttributeDescriptorFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeDescriptorFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Descriptor::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadDescriptorClusterRevision : public ReadAttribute { public: ReadDescriptorClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadDescriptorClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Descriptor::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Descriptor ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDescriptorClusterRevision : public SubscribeAttribute { public: SubscribeAttributeDescriptorClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeDescriptorClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Descriptor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Descriptor::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDescriptor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster Binding | 0x001E | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * Binding | 0x0000 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute Binding */ class ReadBindingBinding : public ReadAttribute { public: ReadBindingBinding() : ReadAttribute("binding") { } ~ReadBindingBinding() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Binding::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Binding::Attributes::Binding::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRReadParams alloc] init]; if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } [cluster readAttributeBindingWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.Binding response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Binding Binding read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteBindingBinding : public WriteAttribute { public: WriteBindingBinding() : WriteAttribute("binding") , mComplex(&mValue) { AddArgument("attr-name", "binding"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteBindingBinding() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Binding::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Binding::Attributes::Binding::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSArray * _Nonnull value; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { MTRBindingClusterTargetStruct * newElement_0; newElement_0 = [MTRBindingClusterTargetStruct new]; if (entry_0.node.HasValue()) { newElement_0.node = [NSNumber numberWithUnsignedLongLong:entry_0.node.Value()]; } else { newElement_0.node = nil; } if (entry_0.group.HasValue()) { newElement_0.group = [NSNumber numberWithUnsignedShort:entry_0.group.Value()]; } else { newElement_0.group = nil; } if (entry_0.endpoint.HasValue()) { newElement_0.endpoint = [NSNumber numberWithUnsignedShort:entry_0.endpoint.Value()]; } else { newElement_0.endpoint = nil; } if (entry_0.cluster.HasValue()) { newElement_0.cluster = [NSNumber numberWithUnsignedInt:entry_0.cluster.Value()]; } else { newElement_0.cluster = nil; } newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } value = array_0; } [cluster writeAttributeBindingWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Binding Binding write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::List mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeBindingBinding : public SubscribeAttribute { public: SubscribeAttributeBindingBinding() : SubscribeAttribute("binding") { } ~SubscribeAttributeBindingBinding() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Binding::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Binding::Attributes::Binding::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBindingWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.Binding response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadBindingGeneratedCommandList : public ReadAttribute { public: ReadBindingGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadBindingGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Binding::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Binding::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Binding GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBindingGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeBindingGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeBindingGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Binding::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Binding::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadBindingAcceptedCommandList : public ReadAttribute { public: ReadBindingAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadBindingAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Binding::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Binding::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Binding AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBindingAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeBindingAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeBindingAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Binding::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Binding::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadBindingEventList : public ReadAttribute { public: ReadBindingEventList() : ReadAttribute("event-list") { } ~ReadBindingEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Binding::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Binding::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Binding EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBindingEventList : public SubscribeAttribute { public: SubscribeAttributeBindingEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeBindingEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Binding::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Binding::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadBindingAttributeList : public ReadAttribute { public: ReadBindingAttributeList() : ReadAttribute("attribute-list") { } ~ReadBindingAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Binding::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Binding::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Binding AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBindingAttributeList : public SubscribeAttribute { public: SubscribeAttributeBindingAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeBindingAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Binding::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Binding::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadBindingFeatureMap : public ReadAttribute { public: ReadBindingFeatureMap() : ReadAttribute("feature-map") { } ~ReadBindingFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Binding::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Binding::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Binding FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBindingFeatureMap : public SubscribeAttribute { public: SubscribeAttributeBindingFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeBindingFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Binding::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Binding::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadBindingClusterRevision : public ReadAttribute { public: ReadBindingClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadBindingClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Binding::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Binding::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Binding ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBindingClusterRevision : public SubscribeAttribute { public: SubscribeAttributeBindingClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeBindingClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Binding::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Binding::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBinding alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster AccessControl | 0x001F | |------------------------------------------------------------------------------| | Commands: | | | * ReviewFabricRestrictions | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * Acl | 0x0000 | | * Extension | 0x0001 | | * SubjectsPerAccessControlEntry | 0x0002 | | * TargetsPerAccessControlEntry | 0x0003 | | * AccessControlEntriesPerFabric | 0x0004 | | * CommissioningARL | 0x0005 | | * Arl | 0x0006 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * AccessControlEntryChanged | 0x0000 | | * AccessControlExtensionChanged | 0x0001 | | * FabricRestrictionReviewUpdate | 0x0002 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command ReviewFabricRestrictions */ class AccessControlReviewFabricRestrictions : public ClusterCommand { public: AccessControlReviewFabricRestrictions() : ClusterCommand("review-fabric-restrictions") , mComplex_Arl(&mRequest.arl) { #if MTR_ENABLE_PROVISIONAL AddArgument("Arl", &mComplex_Arl); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::AccessControl::Commands::ReviewFabricRestrictions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRAccessControlClusterReviewFabricRestrictionsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.arl) { MTRAccessControlClusterCommissioningAccessRestrictionEntryStruct * newElement_0; newElement_0 = [MTRAccessControlClusterCommissioningAccessRestrictionEntryStruct new]; newElement_0.endpoint = [NSNumber numberWithUnsignedShort:entry_0.endpoint]; newElement_0.cluster = [NSNumber numberWithUnsignedInt:entry_0.cluster]; { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.restrictions) { MTRAccessControlClusterAccessRestrictionStruct * newElement_2; newElement_2 = [MTRAccessControlClusterAccessRestrictionStruct new]; newElement_2.type = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.type)]; if (entry_2.id.IsNull()) { newElement_2.id = nil; } else { newElement_2.id = [NSNumber numberWithUnsignedInt:entry_2.id.Value()]; } [array_2 addObject:newElement_2]; } newElement_0.restrictions = array_2; } [array_0 addObject:newElement_0]; } params.arl = array_0; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster reviewFabricRestrictionsWithParams:params completion: ^(MTRAccessControlClusterReviewFabricRestrictionsResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::AccessControl::Commands::ReviewFabricRestrictionsResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::AccessControl::Commands::ReviewFabricRestrictionsResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::AccessControl::Commands::ReviewFabricRestrictions::Type mRequest; TypedComplexArgument> mComplex_Arl; }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute Acl */ class ReadAccessControlAcl : public ReadAttribute { public: ReadAccessControlAcl() : ReadAttribute("acl") { } ~ReadAccessControlAcl() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::Acl::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRReadParams alloc] init]; if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } [cluster readAttributeACLWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.ACL response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccessControl ACL read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteAccessControlAcl : public WriteAttribute { public: WriteAccessControlAcl() : WriteAttribute("acl") , mComplex(&mValue) { AddArgument("attr-name", "acl"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteAccessControlAcl() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::Acl::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSArray * _Nonnull value; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { MTRAccessControlClusterAccessControlEntryStruct * newElement_0; newElement_0 = [MTRAccessControlClusterAccessControlEntryStruct new]; newElement_0.privilege = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.privilege)]; newElement_0.authMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.authMode)]; if (entry_0.subjects.IsNull()) { newElement_0.subjects = nil; } else { { // Scope for our temporary variables auto * array_3 = [NSMutableArray new]; for (auto & entry_3 : entry_0.subjects.Value()) { NSNumber * newElement_3; newElement_3 = [NSNumber numberWithUnsignedLongLong:entry_3]; [array_3 addObject:newElement_3]; } newElement_0.subjects = array_3; } } if (entry_0.targets.IsNull()) { newElement_0.targets = nil; } else { { // Scope for our temporary variables auto * array_3 = [NSMutableArray new]; for (auto & entry_3 : entry_0.targets.Value()) { MTRAccessControlClusterAccessControlTargetStruct * newElement_3; newElement_3 = [MTRAccessControlClusterAccessControlTargetStruct new]; if (entry_3.cluster.IsNull()) { newElement_3.cluster = nil; } else { newElement_3.cluster = [NSNumber numberWithUnsignedInt:entry_3.cluster.Value()]; } if (entry_3.endpoint.IsNull()) { newElement_3.endpoint = nil; } else { newElement_3.endpoint = [NSNumber numberWithUnsignedShort:entry_3.endpoint.Value()]; } if (entry_3.deviceType.IsNull()) { newElement_3.deviceType = nil; } else { newElement_3.deviceType = [NSNumber numberWithUnsignedInt:entry_3.deviceType.Value()]; } [array_3 addObject:newElement_3]; } newElement_0.targets = array_3; } } newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } value = array_0; } [cluster writeAttributeACLWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("AccessControl ACL write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::List mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeAccessControlAcl : public SubscribeAttribute { public: SubscribeAttributeAccessControlAcl() : SubscribeAttribute("acl") { } ~SubscribeAttributeAccessControlAcl() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccessControl::Attributes::Acl::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeACLWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.ACL response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Extension */ class ReadAccessControlExtension : public ReadAttribute { public: ReadAccessControlExtension() : ReadAttribute("extension") { } ~ReadAccessControlExtension() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::Extension::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRReadParams alloc] init]; if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } [cluster readAttributeExtensionWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.Extension response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccessControl Extension read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteAccessControlExtension : public WriteAttribute { public: WriteAccessControlExtension() : WriteAttribute("extension") , mComplex(&mValue) { AddArgument("attr-name", "extension"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteAccessControlExtension() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::Extension::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSArray * _Nonnull value; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { MTRAccessControlClusterAccessControlExtensionStruct * newElement_0; newElement_0 = [MTRAccessControlClusterAccessControlExtensionStruct new]; newElement_0.data = [NSData dataWithBytes:entry_0.data.data() length:entry_0.data.size()]; newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } value = array_0; } [cluster writeAttributeExtensionWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("AccessControl Extension write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::List mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeAccessControlExtension : public SubscribeAttribute { public: SubscribeAttributeAccessControlExtension() : SubscribeAttribute("extension") { } ~SubscribeAttributeAccessControlExtension() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccessControl::Attributes::Extension::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeExtensionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.Extension response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SubjectsPerAccessControlEntry */ class ReadAccessControlSubjectsPerAccessControlEntry : public ReadAttribute { public: ReadAccessControlSubjectsPerAccessControlEntry() : ReadAttribute("subjects-per-access-control-entry") { } ~ReadAccessControlSubjectsPerAccessControlEntry() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::SubjectsPerAccessControlEntry::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSubjectsPerAccessControlEntryWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.SubjectsPerAccessControlEntry response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccessControl SubjectsPerAccessControlEntry read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccessControlSubjectsPerAccessControlEntry : public SubscribeAttribute { public: SubscribeAttributeAccessControlSubjectsPerAccessControlEntry() : SubscribeAttribute("subjects-per-access-control-entry") { } ~SubscribeAttributeAccessControlSubjectsPerAccessControlEntry() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccessControl::Attributes::SubjectsPerAccessControlEntry::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSubjectsPerAccessControlEntryWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.SubjectsPerAccessControlEntry response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TargetsPerAccessControlEntry */ class ReadAccessControlTargetsPerAccessControlEntry : public ReadAttribute { public: ReadAccessControlTargetsPerAccessControlEntry() : ReadAttribute("targets-per-access-control-entry") { } ~ReadAccessControlTargetsPerAccessControlEntry() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::TargetsPerAccessControlEntry::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTargetsPerAccessControlEntryWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.TargetsPerAccessControlEntry response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccessControl TargetsPerAccessControlEntry read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccessControlTargetsPerAccessControlEntry : public SubscribeAttribute { public: SubscribeAttributeAccessControlTargetsPerAccessControlEntry() : SubscribeAttribute("targets-per-access-control-entry") { } ~SubscribeAttributeAccessControlTargetsPerAccessControlEntry() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccessControl::Attributes::TargetsPerAccessControlEntry::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTargetsPerAccessControlEntryWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.TargetsPerAccessControlEntry response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AccessControlEntriesPerFabric */ class ReadAccessControlAccessControlEntriesPerFabric : public ReadAttribute { public: ReadAccessControlAccessControlEntriesPerFabric() : ReadAttribute("access-control-entries-per-fabric") { } ~ReadAccessControlAccessControlEntriesPerFabric() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::AccessControlEntriesPerFabric::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAccessControlEntriesPerFabricWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.AccessControlEntriesPerFabric response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccessControl AccessControlEntriesPerFabric read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccessControlAccessControlEntriesPerFabric : public SubscribeAttribute { public: SubscribeAttributeAccessControlAccessControlEntriesPerFabric() : SubscribeAttribute("access-control-entries-per-fabric") { } ~SubscribeAttributeAccessControlAccessControlEntriesPerFabric() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccessControl::Attributes::AccessControlEntriesPerFabric::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAccessControlEntriesPerFabricWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.AccessControlEntriesPerFabric response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute CommissioningARL */ class ReadAccessControlCommissioningARL : public ReadAttribute { public: ReadAccessControlCommissioningARL() : ReadAttribute("commissioning-arl") { } ~ReadAccessControlCommissioningARL() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::CommissioningARL::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCommissioningARLWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.CommissioningARL response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccessControl CommissioningARL read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccessControlCommissioningARL : public SubscribeAttribute { public: SubscribeAttributeAccessControlCommissioningARL() : SubscribeAttribute("commissioning-arl") { } ~SubscribeAttributeAccessControlCommissioningARL() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccessControl::Attributes::CommissioningARL::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCommissioningARLWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.CommissioningARL response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Arl */ class ReadAccessControlArl : public ReadAttribute { public: ReadAccessControlArl() : ReadAttribute("arl") { } ~ReadAccessControlArl() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::Arl::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRReadParams alloc] init]; if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } [cluster readAttributeARLWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.ARL response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccessControl ARL read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccessControlArl : public SubscribeAttribute { public: SubscribeAttributeAccessControlArl() : SubscribeAttribute("arl") { } ~SubscribeAttributeAccessControlArl() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccessControl::Attributes::Arl::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeARLWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.ARL response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadAccessControlGeneratedCommandList : public ReadAttribute { public: ReadAccessControlGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadAccessControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccessControl GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccessControlGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeAccessControlGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeAccessControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccessControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadAccessControlAcceptedCommandList : public ReadAttribute { public: ReadAccessControlAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadAccessControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccessControl AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccessControlAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeAccessControlAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeAccessControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccessControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadAccessControlEventList : public ReadAttribute { public: ReadAccessControlEventList() : ReadAttribute("event-list") { } ~ReadAccessControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccessControl EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccessControlEventList : public SubscribeAttribute { public: SubscribeAttributeAccessControlEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeAccessControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccessControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadAccessControlAttributeList : public ReadAttribute { public: ReadAccessControlAttributeList() : ReadAttribute("attribute-list") { } ~ReadAccessControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccessControl AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccessControlAttributeList : public SubscribeAttribute { public: SubscribeAttributeAccessControlAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeAccessControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccessControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadAccessControlFeatureMap : public ReadAttribute { public: ReadAccessControlFeatureMap() : ReadAttribute("feature-map") { } ~ReadAccessControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccessControl FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccessControlFeatureMap : public SubscribeAttribute { public: SubscribeAttributeAccessControlFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeAccessControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccessControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadAccessControlClusterRevision : public ReadAttribute { public: ReadAccessControlClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadAccessControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccessControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccessControl ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccessControlClusterRevision : public SubscribeAttribute { public: SubscribeAttributeAccessControlClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeAccessControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccessControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccessControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccessControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster Actions | 0x0025 | |------------------------------------------------------------------------------| | Commands: | | | * InstantAction | 0x00 | | * InstantActionWithTransition | 0x01 | | * StartAction | 0x02 | | * StartActionWithDuration | 0x03 | | * StopAction | 0x04 | | * PauseAction | 0x05 | | * PauseActionWithDuration | 0x06 | | * ResumeAction | 0x07 | | * EnableAction | 0x08 | | * EnableActionWithDuration | 0x09 | | * DisableAction | 0x0A | | * DisableActionWithDuration | 0x0B | |------------------------------------------------------------------------------| | Attributes: | | | * ActionList | 0x0000 | | * EndpointLists | 0x0001 | | * SetupURL | 0x0002 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * StateChanged | 0x0000 | | * ActionFailed | 0x0001 | \*----------------------------------------------------------------------------*/ /* * Command InstantAction */ class ActionsInstantAction : public ClusterCommand { public: ActionsInstantAction() : ClusterCommand("instant-action") { AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Actions::Commands::InstantAction::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRActionsClusterInstantActionParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; if (mRequest.invokeID.HasValue()) { params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; } else { params.invokeID = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster instantActionWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Actions::Commands::InstantAction::Type mRequest; }; /* * Command InstantActionWithTransition */ class ActionsInstantActionWithTransition : public ClusterCommand { public: ActionsInstantActionWithTransition() : ClusterCommand("instant-action-with-transition") { AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Actions::Commands::InstantActionWithTransition::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRActionsClusterInstantActionWithTransitionParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; if (mRequest.invokeID.HasValue()) { params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; } else { params.invokeID = nil; } params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster instantActionWithTransitionWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Actions::Commands::InstantActionWithTransition::Type mRequest; }; /* * Command StartAction */ class ActionsStartAction : public ClusterCommand { public: ActionsStartAction() : ClusterCommand("start-action") { AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Actions::Commands::StartAction::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRActionsClusterStartActionParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; if (mRequest.invokeID.HasValue()) { params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; } else { params.invokeID = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster startActionWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Actions::Commands::StartAction::Type mRequest; }; /* * Command StartActionWithDuration */ class ActionsStartActionWithDuration : public ClusterCommand { public: ActionsStartActionWithDuration() : ClusterCommand("start-action-with-duration") { AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Actions::Commands::StartActionWithDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRActionsClusterStartActionWithDurationParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; if (mRequest.invokeID.HasValue()) { params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; } else { params.invokeID = nil; } params.duration = [NSNumber numberWithUnsignedInt:mRequest.duration]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster startActionWithDurationWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Actions::Commands::StartActionWithDuration::Type mRequest; }; /* * Command StopAction */ class ActionsStopAction : public ClusterCommand { public: ActionsStopAction() : ClusterCommand("stop-action") { AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Actions::Commands::StopAction::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRActionsClusterStopActionParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; if (mRequest.invokeID.HasValue()) { params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; } else { params.invokeID = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stopActionWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Actions::Commands::StopAction::Type mRequest; }; /* * Command PauseAction */ class ActionsPauseAction : public ClusterCommand { public: ActionsPauseAction() : ClusterCommand("pause-action") { AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Actions::Commands::PauseAction::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRActionsClusterPauseActionParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; if (mRequest.invokeID.HasValue()) { params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; } else { params.invokeID = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster pauseActionWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Actions::Commands::PauseAction::Type mRequest; }; /* * Command PauseActionWithDuration */ class ActionsPauseActionWithDuration : public ClusterCommand { public: ActionsPauseActionWithDuration() : ClusterCommand("pause-action-with-duration") { AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Actions::Commands::PauseActionWithDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRActionsClusterPauseActionWithDurationParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; if (mRequest.invokeID.HasValue()) { params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; } else { params.invokeID = nil; } params.duration = [NSNumber numberWithUnsignedInt:mRequest.duration]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster pauseActionWithDurationWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Actions::Commands::PauseActionWithDuration::Type mRequest; }; /* * Command ResumeAction */ class ActionsResumeAction : public ClusterCommand { public: ActionsResumeAction() : ClusterCommand("resume-action") { AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Actions::Commands::ResumeAction::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRActionsClusterResumeActionParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; if (mRequest.invokeID.HasValue()) { params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; } else { params.invokeID = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster resumeActionWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Actions::Commands::ResumeAction::Type mRequest; }; /* * Command EnableAction */ class ActionsEnableAction : public ClusterCommand { public: ActionsEnableAction() : ClusterCommand("enable-action") { AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Actions::Commands::EnableAction::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRActionsClusterEnableActionParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; if (mRequest.invokeID.HasValue()) { params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; } else { params.invokeID = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster enableActionWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Actions::Commands::EnableAction::Type mRequest; }; /* * Command EnableActionWithDuration */ class ActionsEnableActionWithDuration : public ClusterCommand { public: ActionsEnableActionWithDuration() : ClusterCommand("enable-action-with-duration") { AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Actions::Commands::EnableActionWithDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRActionsClusterEnableActionWithDurationParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; if (mRequest.invokeID.HasValue()) { params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; } else { params.invokeID = nil; } params.duration = [NSNumber numberWithUnsignedInt:mRequest.duration]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster enableActionWithDurationWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Actions::Commands::EnableActionWithDuration::Type mRequest; }; /* * Command DisableAction */ class ActionsDisableAction : public ClusterCommand { public: ActionsDisableAction() : ClusterCommand("disable-action") { AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Actions::Commands::DisableAction::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRActionsClusterDisableActionParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; if (mRequest.invokeID.HasValue()) { params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; } else { params.invokeID = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster disableActionWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Actions::Commands::DisableAction::Type mRequest; }; /* * Command DisableActionWithDuration */ class ActionsDisableActionWithDuration : public ClusterCommand { public: ActionsDisableActionWithDuration() : ClusterCommand("disable-action-with-duration") { AddArgument("ActionID", 0, UINT16_MAX, &mRequest.actionID); AddArgument("InvokeID", 0, UINT32_MAX, &mRequest.invokeID); AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Actions::Commands::DisableActionWithDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRActionsClusterDisableActionWithDurationParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.actionID = [NSNumber numberWithUnsignedShort:mRequest.actionID]; if (mRequest.invokeID.HasValue()) { params.invokeID = [NSNumber numberWithUnsignedInt:mRequest.invokeID.Value()]; } else { params.invokeID = nil; } params.duration = [NSNumber numberWithUnsignedInt:mRequest.duration]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster disableActionWithDurationWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Actions::Commands::DisableActionWithDuration::Type mRequest; }; /* * Attribute ActionList */ class ReadActionsActionList : public ReadAttribute { public: ReadActionsActionList() : ReadAttribute("action-list") { } ~ReadActionsActionList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Actions::Attributes::ActionList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActionListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.ActionList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Actions ActionList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActionsActionList : public SubscribeAttribute { public: SubscribeAttributeActionsActionList() : SubscribeAttribute("action-list") { } ~SubscribeAttributeActionsActionList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Actions::Attributes::ActionList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActionListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.ActionList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute EndpointLists */ class ReadActionsEndpointLists : public ReadAttribute { public: ReadActionsEndpointLists() : ReadAttribute("endpoint-lists") { } ~ReadActionsEndpointLists() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Actions::Attributes::EndpointLists::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEndpointListsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.EndpointLists response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Actions EndpointLists read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActionsEndpointLists : public SubscribeAttribute { public: SubscribeAttributeActionsEndpointLists() : SubscribeAttribute("endpoint-lists") { } ~SubscribeAttributeActionsEndpointLists() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Actions::Attributes::EndpointLists::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEndpointListsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.EndpointLists response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SetupURL */ class ReadActionsSetupURL : public ReadAttribute { public: ReadActionsSetupURL() : ReadAttribute("setup-url") { } ~ReadActionsSetupURL() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Actions::Attributes::SetupURL::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSetupURLWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.SetupURL response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Actions SetupURL read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActionsSetupURL : public SubscribeAttribute { public: SubscribeAttributeActionsSetupURL() : SubscribeAttribute("setup-url") { } ~SubscribeAttributeActionsSetupURL() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Actions::Attributes::SetupURL::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSetupURLWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.SetupURL response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadActionsGeneratedCommandList : public ReadAttribute { public: ReadActionsGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadActionsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Actions::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Actions GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActionsGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeActionsGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeActionsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Actions::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadActionsAcceptedCommandList : public ReadAttribute { public: ReadActionsAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadActionsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Actions::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Actions AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActionsAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeActionsAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeActionsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Actions::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadActionsEventList : public ReadAttribute { public: ReadActionsEventList() : ReadAttribute("event-list") { } ~ReadActionsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Actions::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Actions EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActionsEventList : public SubscribeAttribute { public: SubscribeAttributeActionsEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeActionsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Actions::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadActionsAttributeList : public ReadAttribute { public: ReadActionsAttributeList() : ReadAttribute("attribute-list") { } ~ReadActionsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Actions::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Actions AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActionsAttributeList : public SubscribeAttribute { public: SubscribeAttributeActionsAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeActionsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Actions::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadActionsFeatureMap : public ReadAttribute { public: ReadActionsFeatureMap() : ReadAttribute("feature-map") { } ~ReadActionsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Actions::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Actions FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActionsFeatureMap : public SubscribeAttribute { public: SubscribeAttributeActionsFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeActionsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Actions::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadActionsClusterRevision : public ReadAttribute { public: ReadActionsClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadActionsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Actions::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Actions ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActionsClusterRevision : public SubscribeAttribute { public: SubscribeAttributeActionsClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeActionsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Actions::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Actions::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActions alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Actions.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster BasicInformation | 0x0028 | |------------------------------------------------------------------------------| | Commands: | | | * MfgSpecificPing | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * DataModelRevision | 0x0000 | | * VendorName | 0x0001 | | * VendorID | 0x0002 | | * ProductName | 0x0003 | | * ProductID | 0x0004 | | * NodeLabel | 0x0005 | | * Location | 0x0006 | | * HardwareVersion | 0x0007 | | * HardwareVersionString | 0x0008 | | * SoftwareVersion | 0x0009 | | * SoftwareVersionString | 0x000A | | * ManufacturingDate | 0x000B | | * PartNumber | 0x000C | | * ProductURL | 0x000D | | * ProductLabel | 0x000E | | * SerialNumber | 0x000F | | * LocalConfigDisabled | 0x0010 | | * Reachable | 0x0011 | | * UniqueID | 0x0012 | | * CapabilityMinima | 0x0013 | | * ProductAppearance | 0x0014 | | * SpecificationVersion | 0x0015 | | * MaxPathsPerInvoke | 0x0016 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * StartUp | 0x0000 | | * ShutDown | 0x0001 | | * Leave | 0x0002 | | * ReachableChanged | 0x0003 | \*----------------------------------------------------------------------------*/ /* * Attribute DataModelRevision */ class ReadBasicInformationDataModelRevision : public ReadAttribute { public: ReadBasicInformationDataModelRevision() : ReadAttribute("data-model-revision") { } ~ReadBasicInformationDataModelRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::DataModelRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDataModelRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.DataModelRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation DataModelRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationDataModelRevision : public SubscribeAttribute { public: SubscribeAttributeBasicInformationDataModelRevision() : SubscribeAttribute("data-model-revision") { } ~SubscribeAttributeBasicInformationDataModelRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::DataModelRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDataModelRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.DataModelRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute VendorName */ class ReadBasicInformationVendorName : public ReadAttribute { public: ReadBasicInformationVendorName() : ReadAttribute("vendor-name") { } ~ReadBasicInformationVendorName() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::VendorName::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeVendorNameWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.VendorName response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation VendorName read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationVendorName : public SubscribeAttribute { public: SubscribeAttributeBasicInformationVendorName() : SubscribeAttribute("vendor-name") { } ~SubscribeAttributeBasicInformationVendorName() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::VendorName::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeVendorNameWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.VendorName response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute VendorID */ class ReadBasicInformationVendorID : public ReadAttribute { public: ReadBasicInformationVendorID() : ReadAttribute("vendor-id") { } ~ReadBasicInformationVendorID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::VendorID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeVendorIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.VendorID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation VendorID read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationVendorID : public SubscribeAttribute { public: SubscribeAttributeBasicInformationVendorID() : SubscribeAttribute("vendor-id") { } ~SubscribeAttributeBasicInformationVendorID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::VendorID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeVendorIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.VendorID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ProductName */ class ReadBasicInformationProductName : public ReadAttribute { public: ReadBasicInformationProductName() : ReadAttribute("product-name") { } ~ReadBasicInformationProductName() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::ProductName::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeProductNameWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.ProductName response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation ProductName read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationProductName : public SubscribeAttribute { public: SubscribeAttributeBasicInformationProductName() : SubscribeAttribute("product-name") { } ~SubscribeAttributeBasicInformationProductName() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::ProductName::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeProductNameWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.ProductName response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ProductID */ class ReadBasicInformationProductID : public ReadAttribute { public: ReadBasicInformationProductID() : ReadAttribute("product-id") { } ~ReadBasicInformationProductID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::ProductID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeProductIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.ProductID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation ProductID read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationProductID : public SubscribeAttribute { public: SubscribeAttributeBasicInformationProductID() : SubscribeAttribute("product-id") { } ~SubscribeAttributeBasicInformationProductID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::ProductID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeProductIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.ProductID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NodeLabel */ class ReadBasicInformationNodeLabel : public ReadAttribute { public: ReadBasicInformationNodeLabel() : ReadAttribute("node-label") { } ~ReadBasicInformationNodeLabel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::NodeLabel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNodeLabelWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.NodeLabel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation NodeLabel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteBasicInformationNodeLabel : public WriteAttribute { public: WriteBasicInformationNodeLabel() : WriteAttribute("node-label") { AddArgument("attr-name", "node-label"); AddArgument("attr-value", &mValue); WriteAttribute::AddArguments(); } ~WriteBasicInformationNodeLabel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::NodeLabel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() length:mValue.size() encoding:NSUTF8StringEncoding]; [cluster writeAttributeNodeLabelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("BasicInformation NodeLabel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::ByteSpan mValue; }; class SubscribeAttributeBasicInformationNodeLabel : public SubscribeAttribute { public: SubscribeAttributeBasicInformationNodeLabel() : SubscribeAttribute("node-label") { } ~SubscribeAttributeBasicInformationNodeLabel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::NodeLabel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNodeLabelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.NodeLabel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Location */ class ReadBasicInformationLocation : public ReadAttribute { public: ReadBasicInformationLocation() : ReadAttribute("location") { } ~ReadBasicInformationLocation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::Location::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLocationWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.Location response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation Location read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteBasicInformationLocation : public WriteAttribute { public: WriteBasicInformationLocation() : WriteAttribute("location") { AddArgument("attr-name", "location"); AddArgument("attr-value", &mValue); WriteAttribute::AddArguments(); } ~WriteBasicInformationLocation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::Location::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() length:mValue.size() encoding:NSUTF8StringEncoding]; [cluster writeAttributeLocationWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("BasicInformation Location write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::ByteSpan mValue; }; class SubscribeAttributeBasicInformationLocation : public SubscribeAttribute { public: SubscribeAttributeBasicInformationLocation() : SubscribeAttribute("location") { } ~SubscribeAttributeBasicInformationLocation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::Location::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLocationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.Location response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute HardwareVersion */ class ReadBasicInformationHardwareVersion : public ReadAttribute { public: ReadBasicInformationHardwareVersion() : ReadAttribute("hardware-version") { } ~ReadBasicInformationHardwareVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::HardwareVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeHardwareVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.HardwareVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation HardwareVersion read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationHardwareVersion : public SubscribeAttribute { public: SubscribeAttributeBasicInformationHardwareVersion() : SubscribeAttribute("hardware-version") { } ~SubscribeAttributeBasicInformationHardwareVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::HardwareVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeHardwareVersionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.HardwareVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute HardwareVersionString */ class ReadBasicInformationHardwareVersionString : public ReadAttribute { public: ReadBasicInformationHardwareVersionString() : ReadAttribute("hardware-version-string") { } ~ReadBasicInformationHardwareVersionString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::HardwareVersionString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeHardwareVersionStringWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.HardwareVersionString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation HardwareVersionString read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationHardwareVersionString : public SubscribeAttribute { public: SubscribeAttributeBasicInformationHardwareVersionString() : SubscribeAttribute("hardware-version-string") { } ~SubscribeAttributeBasicInformationHardwareVersionString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::HardwareVersionString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeHardwareVersionStringWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.HardwareVersionString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SoftwareVersion */ class ReadBasicInformationSoftwareVersion : public ReadAttribute { public: ReadBasicInformationSoftwareVersion() : ReadAttribute("software-version") { } ~ReadBasicInformationSoftwareVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::SoftwareVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSoftwareVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.SoftwareVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation SoftwareVersion read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationSoftwareVersion : public SubscribeAttribute { public: SubscribeAttributeBasicInformationSoftwareVersion() : SubscribeAttribute("software-version") { } ~SubscribeAttributeBasicInformationSoftwareVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::SoftwareVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSoftwareVersionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.SoftwareVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SoftwareVersionString */ class ReadBasicInformationSoftwareVersionString : public ReadAttribute { public: ReadBasicInformationSoftwareVersionString() : ReadAttribute("software-version-string") { } ~ReadBasicInformationSoftwareVersionString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::SoftwareVersionString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSoftwareVersionStringWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.SoftwareVersionString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation SoftwareVersionString read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationSoftwareVersionString : public SubscribeAttribute { public: SubscribeAttributeBasicInformationSoftwareVersionString() : SubscribeAttribute("software-version-string") { } ~SubscribeAttributeBasicInformationSoftwareVersionString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::SoftwareVersionString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSoftwareVersionStringWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.SoftwareVersionString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ManufacturingDate */ class ReadBasicInformationManufacturingDate : public ReadAttribute { public: ReadBasicInformationManufacturingDate() : ReadAttribute("manufacturing-date") { } ~ReadBasicInformationManufacturingDate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::ManufacturingDate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeManufacturingDateWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.ManufacturingDate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation ManufacturingDate read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationManufacturingDate : public SubscribeAttribute { public: SubscribeAttributeBasicInformationManufacturingDate() : SubscribeAttribute("manufacturing-date") { } ~SubscribeAttributeBasicInformationManufacturingDate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::ManufacturingDate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeManufacturingDateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.ManufacturingDate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PartNumber */ class ReadBasicInformationPartNumber : public ReadAttribute { public: ReadBasicInformationPartNumber() : ReadAttribute("part-number") { } ~ReadBasicInformationPartNumber() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::PartNumber::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePartNumberWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.PartNumber response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation PartNumber read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationPartNumber : public SubscribeAttribute { public: SubscribeAttributeBasicInformationPartNumber() : SubscribeAttribute("part-number") { } ~SubscribeAttributeBasicInformationPartNumber() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::PartNumber::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePartNumberWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.PartNumber response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ProductURL */ class ReadBasicInformationProductURL : public ReadAttribute { public: ReadBasicInformationProductURL() : ReadAttribute("product-url") { } ~ReadBasicInformationProductURL() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::ProductURL::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeProductURLWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.ProductURL response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation ProductURL read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationProductURL : public SubscribeAttribute { public: SubscribeAttributeBasicInformationProductURL() : SubscribeAttribute("product-url") { } ~SubscribeAttributeBasicInformationProductURL() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::ProductURL::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeProductURLWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.ProductURL response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ProductLabel */ class ReadBasicInformationProductLabel : public ReadAttribute { public: ReadBasicInformationProductLabel() : ReadAttribute("product-label") { } ~ReadBasicInformationProductLabel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::ProductLabel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeProductLabelWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.ProductLabel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation ProductLabel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationProductLabel : public SubscribeAttribute { public: SubscribeAttributeBasicInformationProductLabel() : SubscribeAttribute("product-label") { } ~SubscribeAttributeBasicInformationProductLabel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::ProductLabel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeProductLabelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.ProductLabel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SerialNumber */ class ReadBasicInformationSerialNumber : public ReadAttribute { public: ReadBasicInformationSerialNumber() : ReadAttribute("serial-number") { } ~ReadBasicInformationSerialNumber() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::SerialNumber::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSerialNumberWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.SerialNumber response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation SerialNumber read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationSerialNumber : public SubscribeAttribute { public: SubscribeAttributeBasicInformationSerialNumber() : SubscribeAttribute("serial-number") { } ~SubscribeAttributeBasicInformationSerialNumber() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::SerialNumber::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSerialNumberWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.SerialNumber response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LocalConfigDisabled */ class ReadBasicInformationLocalConfigDisabled : public ReadAttribute { public: ReadBasicInformationLocalConfigDisabled() : ReadAttribute("local-config-disabled") { } ~ReadBasicInformationLocalConfigDisabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::LocalConfigDisabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLocalConfigDisabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.LocalConfigDisabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation LocalConfigDisabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteBasicInformationLocalConfigDisabled : public WriteAttribute { public: WriteBasicInformationLocalConfigDisabled() : WriteAttribute("local-config-disabled") { AddArgument("attr-name", "local-config-disabled"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteBasicInformationLocalConfigDisabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::LocalConfigDisabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeLocalConfigDisabledWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("BasicInformation LocalConfigDisabled write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeBasicInformationLocalConfigDisabled : public SubscribeAttribute { public: SubscribeAttributeBasicInformationLocalConfigDisabled() : SubscribeAttribute("local-config-disabled") { } ~SubscribeAttributeBasicInformationLocalConfigDisabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::LocalConfigDisabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLocalConfigDisabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.LocalConfigDisabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Reachable */ class ReadBasicInformationReachable : public ReadAttribute { public: ReadBasicInformationReachable() : ReadAttribute("reachable") { } ~ReadBasicInformationReachable() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::Reachable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeReachableWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.Reachable response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation Reachable read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationReachable : public SubscribeAttribute { public: SubscribeAttributeBasicInformationReachable() : SubscribeAttribute("reachable") { } ~SubscribeAttributeBasicInformationReachable() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::Reachable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeReachableWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.Reachable response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute UniqueID */ class ReadBasicInformationUniqueID : public ReadAttribute { public: ReadBasicInformationUniqueID() : ReadAttribute("unique-id") { } ~ReadBasicInformationUniqueID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::UniqueID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUniqueIDWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.UniqueID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation UniqueID read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationUniqueID : public SubscribeAttribute { public: SubscribeAttributeBasicInformationUniqueID() : SubscribeAttribute("unique-id") { } ~SubscribeAttributeBasicInformationUniqueID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::UniqueID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUniqueIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.UniqueID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CapabilityMinima */ class ReadBasicInformationCapabilityMinima : public ReadAttribute { public: ReadBasicInformationCapabilityMinima() : ReadAttribute("capability-minima") { } ~ReadBasicInformationCapabilityMinima() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::CapabilityMinima::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCapabilityMinimaWithCompletion:^(MTRBasicInformationClusterCapabilityMinimaStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.CapabilityMinima response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation CapabilityMinima read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationCapabilityMinima : public SubscribeAttribute { public: SubscribeAttributeBasicInformationCapabilityMinima() : SubscribeAttribute("capability-minima") { } ~SubscribeAttributeBasicInformationCapabilityMinima() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::CapabilityMinima::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCapabilityMinimaWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRBasicInformationClusterCapabilityMinimaStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.CapabilityMinima response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ProductAppearance */ class ReadBasicInformationProductAppearance : public ReadAttribute { public: ReadBasicInformationProductAppearance() : ReadAttribute("product-appearance") { } ~ReadBasicInformationProductAppearance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::ProductAppearance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeProductAppearanceWithCompletion:^(MTRBasicInformationClusterProductAppearanceStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.ProductAppearance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation ProductAppearance read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationProductAppearance : public SubscribeAttribute { public: SubscribeAttributeBasicInformationProductAppearance() : SubscribeAttribute("product-appearance") { } ~SubscribeAttributeBasicInformationProductAppearance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::ProductAppearance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeProductAppearanceWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRBasicInformationClusterProductAppearanceStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.ProductAppearance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute SpecificationVersion */ class ReadBasicInformationSpecificationVersion : public ReadAttribute { public: ReadBasicInformationSpecificationVersion() : ReadAttribute("specification-version") { } ~ReadBasicInformationSpecificationVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::SpecificationVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSpecificationVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.SpecificationVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation SpecificationVersion read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationSpecificationVersion : public SubscribeAttribute { public: SubscribeAttributeBasicInformationSpecificationVersion() : SubscribeAttribute("specification-version") { } ~SubscribeAttributeBasicInformationSpecificationVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::SpecificationVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSpecificationVersionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.SpecificationVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MaxPathsPerInvoke */ class ReadBasicInformationMaxPathsPerInvoke : public ReadAttribute { public: ReadBasicInformationMaxPathsPerInvoke() : ReadAttribute("max-paths-per-invoke") { } ~ReadBasicInformationMaxPathsPerInvoke() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::MaxPathsPerInvoke::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxPathsPerInvokeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.MaxPathsPerInvoke response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation MaxPathsPerInvoke read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationMaxPathsPerInvoke : public SubscribeAttribute { public: SubscribeAttributeBasicInformationMaxPathsPerInvoke() : SubscribeAttribute("max-paths-per-invoke") { } ~SubscribeAttributeBasicInformationMaxPathsPerInvoke() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::MaxPathsPerInvoke::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxPathsPerInvokeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.MaxPathsPerInvoke response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadBasicInformationGeneratedCommandList : public ReadAttribute { public: ReadBasicInformationGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadBasicInformationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeBasicInformationGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeBasicInformationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadBasicInformationAcceptedCommandList : public ReadAttribute { public: ReadBasicInformationAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadBasicInformationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeBasicInformationAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeBasicInformationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadBasicInformationEventList : public ReadAttribute { public: ReadBasicInformationEventList() : ReadAttribute("event-list") { } ~ReadBasicInformationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationEventList : public SubscribeAttribute { public: SubscribeAttributeBasicInformationEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeBasicInformationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadBasicInformationAttributeList : public ReadAttribute { public: ReadBasicInformationAttributeList() : ReadAttribute("attribute-list") { } ~ReadBasicInformationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationAttributeList : public SubscribeAttribute { public: SubscribeAttributeBasicInformationAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeBasicInformationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadBasicInformationFeatureMap : public ReadAttribute { public: ReadBasicInformationFeatureMap() : ReadAttribute("feature-map") { } ~ReadBasicInformationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationFeatureMap : public SubscribeAttribute { public: SubscribeAttributeBasicInformationFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeBasicInformationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadBasicInformationClusterRevision : public ReadAttribute { public: ReadBasicInformationClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadBasicInformationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BasicInformation::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BasicInformation ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBasicInformationClusterRevision : public SubscribeAttribute { public: SubscribeAttributeBasicInformationClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeBasicInformationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BasicInformation::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BasicInformation.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster OtaSoftwareUpdateProvider | 0x0029 | |------------------------------------------------------------------------------| | Commands: | | | * QueryImage | 0x00 | | * ApplyUpdateRequest | 0x02 | | * NotifyUpdateApplied | 0x04 | |------------------------------------------------------------------------------| | Attributes: | | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command QueryImage */ class OtaSoftwareUpdateProviderQueryImage : public ClusterCommand { public: OtaSoftwareUpdateProviderQueryImage() : ClusterCommand("query-image") , mComplex_ProtocolsSupported(&mRequest.protocolsSupported) { AddArgument("VendorID", 0, UINT16_MAX, &mRequest.vendorID); AddArgument("ProductID", 0, UINT16_MAX, &mRequest.productID); AddArgument("SoftwareVersion", 0, UINT32_MAX, &mRequest.softwareVersion); AddArgument("ProtocolsSupported", &mComplex_ProtocolsSupported); AddArgument("HardwareVersion", 0, UINT16_MAX, &mRequest.hardwareVersion); AddArgument("Location", &mRequest.location); AddArgument("RequestorCanConsent", 0, 1, &mRequest.requestorCanConsent); AddArgument("MetadataForProvider", &mRequest.metadataForProvider); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateProvider::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROTASoftwareUpdateProviderClusterQueryImageParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.vendorID = [NSNumber numberWithUnsignedShort:chip::to_underlying(mRequest.vendorID)]; params.productID = [NSNumber numberWithUnsignedShort:mRequest.productID]; params.softwareVersion = [NSNumber numberWithUnsignedInt:mRequest.softwareVersion]; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.protocolsSupported) { NSNumber * newElement_0; newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; [array_0 addObject:newElement_0]; } params.protocolsSupported = array_0; } if (mRequest.hardwareVersion.HasValue()) { params.hardwareVersion = [NSNumber numberWithUnsignedShort:mRequest.hardwareVersion.Value()]; } else { params.hardwareVersion = nil; } if (mRequest.location.HasValue()) { params.location = [[NSString alloc] initWithBytes:mRequest.location.Value().data() length:mRequest.location.Value().size() encoding:NSUTF8StringEncoding]; } else { params.location = nil; } if (mRequest.requestorCanConsent.HasValue()) { params.requestorCanConsent = [NSNumber numberWithBool:mRequest.requestorCanConsent.Value()]; } else { params.requestorCanConsent = nil; } if (mRequest.metadataForProvider.HasValue()) { params.metadataForProvider = [NSData dataWithBytes:mRequest.metadataForProvider.Value().data() length:mRequest.metadataForProvider.Value().size()]; } else { params.metadataForProvider = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster queryImageWithParams:params completion: ^(MTROTASoftwareUpdateProviderClusterQueryImageResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImageResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImageResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::Type mRequest; TypedComplexArgument> mComplex_ProtocolsSupported; }; /* * Command ApplyUpdateRequest */ class OtaSoftwareUpdateProviderApplyUpdateRequest : public ClusterCommand { public: OtaSoftwareUpdateProviderApplyUpdateRequest() : ClusterCommand("apply-update-request") { AddArgument("UpdateToken", &mRequest.updateToken); AddArgument("NewVersion", 0, UINT32_MAX, &mRequest.newVersion); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateProvider::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROTASoftwareUpdateProviderClusterApplyUpdateRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.updateToken = [NSData dataWithBytes:mRequest.updateToken.data() length:mRequest.updateToken.size()]; params.newVersion = [NSNumber numberWithUnsignedInt:mRequest.newVersion]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster applyUpdateRequestWithParams:params completion: ^(MTROTASoftwareUpdateProviderClusterApplyUpdateResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest::Type mRequest; }; /* * Command NotifyUpdateApplied */ class OtaSoftwareUpdateProviderNotifyUpdateApplied : public ClusterCommand { public: OtaSoftwareUpdateProviderNotifyUpdateApplied() : ClusterCommand("notify-update-applied") { AddArgument("UpdateToken", &mRequest.updateToken); AddArgument("SoftwareVersion", 0, UINT32_MAX, &mRequest.softwareVersion); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateProvider::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::NotifyUpdateApplied::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROTASoftwareUpdateProviderClusterNotifyUpdateAppliedParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.updateToken = [NSData dataWithBytes:mRequest.updateToken.data() length:mRequest.updateToken.size()]; params.softwareVersion = [NSNumber numberWithUnsignedInt:mRequest.softwareVersion]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster notifyUpdateAppliedWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::NotifyUpdateApplied::Type mRequest; }; /* * Attribute GeneratedCommandList */ class ReadOtaSoftwareUpdateProviderGeneratedCommandList : public ReadAttribute { public: ReadOtaSoftwareUpdateProviderGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadOtaSoftwareUpdateProviderGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateProvider::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateProvider.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OTASoftwareUpdateProvider GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOtaSoftwareUpdateProviderGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeOtaSoftwareUpdateProviderGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeOtaSoftwareUpdateProviderGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateProvider::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateProvider.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadOtaSoftwareUpdateProviderAcceptedCommandList : public ReadAttribute { public: ReadOtaSoftwareUpdateProviderAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadOtaSoftwareUpdateProviderAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateProvider::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateProvider.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OTASoftwareUpdateProvider AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOtaSoftwareUpdateProviderAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeOtaSoftwareUpdateProviderAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeOtaSoftwareUpdateProviderAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateProvider::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateProvider.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadOtaSoftwareUpdateProviderEventList : public ReadAttribute { public: ReadOtaSoftwareUpdateProviderEventList() : ReadAttribute("event-list") { } ~ReadOtaSoftwareUpdateProviderEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateProvider::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateProvider.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OTASoftwareUpdateProvider EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOtaSoftwareUpdateProviderEventList : public SubscribeAttribute { public: SubscribeAttributeOtaSoftwareUpdateProviderEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeOtaSoftwareUpdateProviderEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateProvider::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateProvider.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadOtaSoftwareUpdateProviderAttributeList : public ReadAttribute { public: ReadOtaSoftwareUpdateProviderAttributeList() : ReadAttribute("attribute-list") { } ~ReadOtaSoftwareUpdateProviderAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateProvider::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateProvider.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OTASoftwareUpdateProvider AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOtaSoftwareUpdateProviderAttributeList : public SubscribeAttribute { public: SubscribeAttributeOtaSoftwareUpdateProviderAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeOtaSoftwareUpdateProviderAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateProvider::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateProvider.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadOtaSoftwareUpdateProviderFeatureMap : public ReadAttribute { public: ReadOtaSoftwareUpdateProviderFeatureMap() : ReadAttribute("feature-map") { } ~ReadOtaSoftwareUpdateProviderFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateProvider::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateProvider.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OTASoftwareUpdateProvider FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOtaSoftwareUpdateProviderFeatureMap : public SubscribeAttribute { public: SubscribeAttributeOtaSoftwareUpdateProviderFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeOtaSoftwareUpdateProviderFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateProvider::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateProvider.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadOtaSoftwareUpdateProviderClusterRevision : public ReadAttribute { public: ReadOtaSoftwareUpdateProviderClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadOtaSoftwareUpdateProviderClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateProvider::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateProvider.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OTASoftwareUpdateProvider ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOtaSoftwareUpdateProviderClusterRevision : public SubscribeAttribute { public: SubscribeAttributeOtaSoftwareUpdateProviderClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeOtaSoftwareUpdateProviderClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateProvider::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OtaSoftwareUpdateProvider::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateProvider.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster OtaSoftwareUpdateRequestor | 0x002A | |------------------------------------------------------------------------------| | Commands: | | | * AnnounceOTAProvider | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * DefaultOTAProviders | 0x0000 | | * UpdatePossible | 0x0001 | | * UpdateState | 0x0002 | | * UpdateStateProgress | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * StateTransition | 0x0000 | | * VersionApplied | 0x0001 | | * DownloadError | 0x0002 | \*----------------------------------------------------------------------------*/ /* * Command AnnounceOTAProvider */ class OtaSoftwareUpdateRequestorAnnounceOTAProvider : public ClusterCommand { public: OtaSoftwareUpdateRequestorAnnounceOTAProvider() : ClusterCommand("announce-otaprovider") { AddArgument("ProviderNodeID", 0, UINT64_MAX, &mRequest.providerNodeID); AddArgument("VendorID", 0, UINT16_MAX, &mRequest.vendorID); AddArgument("AnnouncementReason", 0, UINT8_MAX, &mRequest.announcementReason); AddArgument("MetadataForNode", &mRequest.metadataForNode); AddArgument("Endpoint", 0, UINT16_MAX, &mRequest.endpoint); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Commands::AnnounceOTAProvider::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROTASoftwareUpdateRequestorClusterAnnounceOTAProviderParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.providerNodeID = [NSNumber numberWithUnsignedLongLong:mRequest.providerNodeID]; params.vendorID = [NSNumber numberWithUnsignedShort:chip::to_underlying(mRequest.vendorID)]; params.announcementReason = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.announcementReason)]; if (mRequest.metadataForNode.HasValue()) { params.metadataForNode = [NSData dataWithBytes:mRequest.metadataForNode.Value().data() length:mRequest.metadataForNode.Value().size()]; } else { params.metadataForNode = nil; } params.endpoint = [NSNumber numberWithUnsignedShort:mRequest.endpoint]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster announceOTAProviderWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::OtaSoftwareUpdateRequestor::Commands::AnnounceOTAProvider::Type mRequest; }; /* * Attribute DefaultOTAProviders */ class ReadOtaSoftwareUpdateRequestorDefaultOTAProviders : public ReadAttribute { public: ReadOtaSoftwareUpdateRequestorDefaultOTAProviders() : ReadAttribute("default-otaproviders") { } ~ReadOtaSoftwareUpdateRequestorDefaultOTAProviders() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::DefaultOTAProviders::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRReadParams alloc] init]; if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } [cluster readAttributeDefaultOTAProvidersWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.DefaultOTAProviders response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OTASoftwareUpdateRequestor DefaultOTAProviders read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteOtaSoftwareUpdateRequestorDefaultOTAProviders : public WriteAttribute { public: WriteOtaSoftwareUpdateRequestorDefaultOTAProviders() : WriteAttribute("default-otaproviders") , mComplex(&mValue) { AddArgument("attr-name", "default-otaproviders"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteOtaSoftwareUpdateRequestorDefaultOTAProviders() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::DefaultOTAProviders::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSArray * _Nonnull value; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { MTROTASoftwareUpdateRequestorClusterProviderLocation * newElement_0; newElement_0 = [MTROTASoftwareUpdateRequestorClusterProviderLocation new]; newElement_0.providerNodeID = [NSNumber numberWithUnsignedLongLong:entry_0.providerNodeID]; newElement_0.endpoint = [NSNumber numberWithUnsignedShort:entry_0.endpoint]; newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } value = array_0; } [cluster writeAttributeDefaultOTAProvidersWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("OTASoftwareUpdateRequestor DefaultOTAProviders write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::List mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeOtaSoftwareUpdateRequestorDefaultOTAProviders : public SubscribeAttribute { public: SubscribeAttributeOtaSoftwareUpdateRequestorDefaultOTAProviders() : SubscribeAttribute("default-otaproviders") { } ~SubscribeAttributeOtaSoftwareUpdateRequestorDefaultOTAProviders() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::DefaultOTAProviders::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDefaultOTAProvidersWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.DefaultOTAProviders response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute UpdatePossible */ class ReadOtaSoftwareUpdateRequestorUpdatePossible : public ReadAttribute { public: ReadOtaSoftwareUpdateRequestorUpdatePossible() : ReadAttribute("update-possible") { } ~ReadOtaSoftwareUpdateRequestorUpdatePossible() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::UpdatePossible::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUpdatePossibleWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.UpdatePossible response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OTASoftwareUpdateRequestor UpdatePossible read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOtaSoftwareUpdateRequestorUpdatePossible : public SubscribeAttribute { public: SubscribeAttributeOtaSoftwareUpdateRequestorUpdatePossible() : SubscribeAttribute("update-possible") { } ~SubscribeAttributeOtaSoftwareUpdateRequestorUpdatePossible() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::UpdatePossible::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUpdatePossibleWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.UpdatePossible response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute UpdateState */ class ReadOtaSoftwareUpdateRequestorUpdateState : public ReadAttribute { public: ReadOtaSoftwareUpdateRequestorUpdateState() : ReadAttribute("update-state") { } ~ReadOtaSoftwareUpdateRequestorUpdateState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::UpdateState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUpdateStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.UpdateState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OTASoftwareUpdateRequestor UpdateState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOtaSoftwareUpdateRequestorUpdateState : public SubscribeAttribute { public: SubscribeAttributeOtaSoftwareUpdateRequestorUpdateState() : SubscribeAttribute("update-state") { } ~SubscribeAttributeOtaSoftwareUpdateRequestorUpdateState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::UpdateState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUpdateStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.UpdateState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute UpdateStateProgress */ class ReadOtaSoftwareUpdateRequestorUpdateStateProgress : public ReadAttribute { public: ReadOtaSoftwareUpdateRequestorUpdateStateProgress() : ReadAttribute("update-state-progress") { } ~ReadOtaSoftwareUpdateRequestorUpdateStateProgress() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::UpdateStateProgress::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUpdateStateProgressWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.UpdateStateProgress response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OTASoftwareUpdateRequestor UpdateStateProgress read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOtaSoftwareUpdateRequestorUpdateStateProgress : public SubscribeAttribute { public: SubscribeAttributeOtaSoftwareUpdateRequestorUpdateStateProgress() : SubscribeAttribute("update-state-progress") { } ~SubscribeAttributeOtaSoftwareUpdateRequestorUpdateStateProgress() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::UpdateStateProgress::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUpdateStateProgressWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.UpdateStateProgress response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadOtaSoftwareUpdateRequestorGeneratedCommandList : public ReadAttribute { public: ReadOtaSoftwareUpdateRequestorGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadOtaSoftwareUpdateRequestorGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OTASoftwareUpdateRequestor GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOtaSoftwareUpdateRequestorGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeOtaSoftwareUpdateRequestorGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeOtaSoftwareUpdateRequestorGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadOtaSoftwareUpdateRequestorAcceptedCommandList : public ReadAttribute { public: ReadOtaSoftwareUpdateRequestorAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadOtaSoftwareUpdateRequestorAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OTASoftwareUpdateRequestor AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOtaSoftwareUpdateRequestorAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeOtaSoftwareUpdateRequestorAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeOtaSoftwareUpdateRequestorAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadOtaSoftwareUpdateRequestorEventList : public ReadAttribute { public: ReadOtaSoftwareUpdateRequestorEventList() : ReadAttribute("event-list") { } ~ReadOtaSoftwareUpdateRequestorEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OTASoftwareUpdateRequestor EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOtaSoftwareUpdateRequestorEventList : public SubscribeAttribute { public: SubscribeAttributeOtaSoftwareUpdateRequestorEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeOtaSoftwareUpdateRequestorEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadOtaSoftwareUpdateRequestorAttributeList : public ReadAttribute { public: ReadOtaSoftwareUpdateRequestorAttributeList() : ReadAttribute("attribute-list") { } ~ReadOtaSoftwareUpdateRequestorAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OTASoftwareUpdateRequestor AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOtaSoftwareUpdateRequestorAttributeList : public SubscribeAttribute { public: SubscribeAttributeOtaSoftwareUpdateRequestorAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeOtaSoftwareUpdateRequestorAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadOtaSoftwareUpdateRequestorFeatureMap : public ReadAttribute { public: ReadOtaSoftwareUpdateRequestorFeatureMap() : ReadAttribute("feature-map") { } ~ReadOtaSoftwareUpdateRequestorFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OTASoftwareUpdateRequestor FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOtaSoftwareUpdateRequestorFeatureMap : public SubscribeAttribute { public: SubscribeAttributeOtaSoftwareUpdateRequestorFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeOtaSoftwareUpdateRequestorFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadOtaSoftwareUpdateRequestorClusterRevision : public ReadAttribute { public: ReadOtaSoftwareUpdateRequestorClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadOtaSoftwareUpdateRequestorClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OTASoftwareUpdateRequestor ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOtaSoftwareUpdateRequestorClusterRevision : public SubscribeAttribute { public: SubscribeAttributeOtaSoftwareUpdateRequestorClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeOtaSoftwareUpdateRequestorClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OtaSoftwareUpdateRequestor::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OTASoftwareUpdateRequestor.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster LocalizationConfiguration | 0x002B | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * ActiveLocale | 0x0000 | | * SupportedLocales | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute ActiveLocale */ class ReadLocalizationConfigurationActiveLocale : public ReadAttribute { public: ReadLocalizationConfigurationActiveLocale() : ReadAttribute("active-locale") { } ~ReadLocalizationConfigurationActiveLocale() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::ActiveLocale::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveLocaleWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.ActiveLocale response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LocalizationConfiguration ActiveLocale read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteLocalizationConfigurationActiveLocale : public WriteAttribute { public: WriteLocalizationConfigurationActiveLocale() : WriteAttribute("active-locale") { AddArgument("attr-name", "active-locale"); AddArgument("attr-value", &mValue); WriteAttribute::AddArguments(); } ~WriteLocalizationConfigurationActiveLocale() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::ActiveLocale::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() length:mValue.size() encoding:NSUTF8StringEncoding]; [cluster writeAttributeActiveLocaleWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("LocalizationConfiguration ActiveLocale write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::ByteSpan mValue; }; class SubscribeAttributeLocalizationConfigurationActiveLocale : public SubscribeAttribute { public: SubscribeAttributeLocalizationConfigurationActiveLocale() : SubscribeAttribute("active-locale") { } ~SubscribeAttributeLocalizationConfigurationActiveLocale() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::ActiveLocale::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveLocaleWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.ActiveLocale response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SupportedLocales */ class ReadLocalizationConfigurationSupportedLocales : public ReadAttribute { public: ReadLocalizationConfigurationSupportedLocales() : ReadAttribute("supported-locales") { } ~ReadLocalizationConfigurationSupportedLocales() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::SupportedLocales::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedLocalesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.SupportedLocales response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LocalizationConfiguration SupportedLocales read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLocalizationConfigurationSupportedLocales : public SubscribeAttribute { public: SubscribeAttributeLocalizationConfigurationSupportedLocales() : SubscribeAttribute("supported-locales") { } ~SubscribeAttributeLocalizationConfigurationSupportedLocales() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::SupportedLocales::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedLocalesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.SupportedLocales response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadLocalizationConfigurationGeneratedCommandList : public ReadAttribute { public: ReadLocalizationConfigurationGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadLocalizationConfigurationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LocalizationConfiguration GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLocalizationConfigurationGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeLocalizationConfigurationGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeLocalizationConfigurationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadLocalizationConfigurationAcceptedCommandList : public ReadAttribute { public: ReadLocalizationConfigurationAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadLocalizationConfigurationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LocalizationConfiguration AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLocalizationConfigurationAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeLocalizationConfigurationAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeLocalizationConfigurationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadLocalizationConfigurationEventList : public ReadAttribute { public: ReadLocalizationConfigurationEventList() : ReadAttribute("event-list") { } ~ReadLocalizationConfigurationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LocalizationConfiguration EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLocalizationConfigurationEventList : public SubscribeAttribute { public: SubscribeAttributeLocalizationConfigurationEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeLocalizationConfigurationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadLocalizationConfigurationAttributeList : public ReadAttribute { public: ReadLocalizationConfigurationAttributeList() : ReadAttribute("attribute-list") { } ~ReadLocalizationConfigurationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LocalizationConfiguration AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLocalizationConfigurationAttributeList : public SubscribeAttribute { public: SubscribeAttributeLocalizationConfigurationAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeLocalizationConfigurationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadLocalizationConfigurationFeatureMap : public ReadAttribute { public: ReadLocalizationConfigurationFeatureMap() : ReadAttribute("feature-map") { } ~ReadLocalizationConfigurationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LocalizationConfiguration FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLocalizationConfigurationFeatureMap : public SubscribeAttribute { public: SubscribeAttributeLocalizationConfigurationFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeLocalizationConfigurationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadLocalizationConfigurationClusterRevision : public ReadAttribute { public: ReadLocalizationConfigurationClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadLocalizationConfigurationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LocalizationConfiguration ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLocalizationConfigurationClusterRevision : public SubscribeAttribute { public: SubscribeAttributeLocalizationConfigurationClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeLocalizationConfigurationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LocalizationConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LocalizationConfiguration::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLocalizationConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster TimeFormatLocalization | 0x002C | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * HourFormat | 0x0000 | | * ActiveCalendarType | 0x0001 | | * SupportedCalendarTypes | 0x0002 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute HourFormat */ class ReadTimeFormatLocalizationHourFormat : public ReadAttribute { public: ReadTimeFormatLocalizationHourFormat() : ReadAttribute("hour-format") { } ~ReadTimeFormatLocalizationHourFormat() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::HourFormat::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeHourFormatWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.HourFormat response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeFormatLocalization HourFormat read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteTimeFormatLocalizationHourFormat : public WriteAttribute { public: WriteTimeFormatLocalizationHourFormat() : WriteAttribute("hour-format") { AddArgument("attr-name", "hour-format"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteTimeFormatLocalizationHourFormat() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::HourFormat::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeHourFormatWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("TimeFormatLocalization HourFormat write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeTimeFormatLocalizationHourFormat : public SubscribeAttribute { public: SubscribeAttributeTimeFormatLocalizationHourFormat() : SubscribeAttribute("hour-format") { } ~SubscribeAttributeTimeFormatLocalizationHourFormat() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::HourFormat::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeHourFormatWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.HourFormat response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ActiveCalendarType */ class ReadTimeFormatLocalizationActiveCalendarType : public ReadAttribute { public: ReadTimeFormatLocalizationActiveCalendarType() : ReadAttribute("active-calendar-type") { } ~ReadTimeFormatLocalizationActiveCalendarType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::ActiveCalendarType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveCalendarTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.ActiveCalendarType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeFormatLocalization ActiveCalendarType read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteTimeFormatLocalizationActiveCalendarType : public WriteAttribute { public: WriteTimeFormatLocalizationActiveCalendarType() : WriteAttribute("active-calendar-type") { AddArgument("attr-name", "active-calendar-type"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteTimeFormatLocalizationActiveCalendarType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::ActiveCalendarType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeActiveCalendarTypeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("TimeFormatLocalization ActiveCalendarType write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeTimeFormatLocalizationActiveCalendarType : public SubscribeAttribute { public: SubscribeAttributeTimeFormatLocalizationActiveCalendarType() : SubscribeAttribute("active-calendar-type") { } ~SubscribeAttributeTimeFormatLocalizationActiveCalendarType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::ActiveCalendarType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveCalendarTypeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.ActiveCalendarType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SupportedCalendarTypes */ class ReadTimeFormatLocalizationSupportedCalendarTypes : public ReadAttribute { public: ReadTimeFormatLocalizationSupportedCalendarTypes() : ReadAttribute("supported-calendar-types") { } ~ReadTimeFormatLocalizationSupportedCalendarTypes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::SupportedCalendarTypes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedCalendarTypesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.SupportedCalendarTypes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeFormatLocalization SupportedCalendarTypes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeFormatLocalizationSupportedCalendarTypes : public SubscribeAttribute { public: SubscribeAttributeTimeFormatLocalizationSupportedCalendarTypes() : SubscribeAttribute("supported-calendar-types") { } ~SubscribeAttributeTimeFormatLocalizationSupportedCalendarTypes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::SupportedCalendarTypes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedCalendarTypesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.SupportedCalendarTypes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadTimeFormatLocalizationGeneratedCommandList : public ReadAttribute { public: ReadTimeFormatLocalizationGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadTimeFormatLocalizationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeFormatLocalization GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeFormatLocalizationGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeTimeFormatLocalizationGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeTimeFormatLocalizationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadTimeFormatLocalizationAcceptedCommandList : public ReadAttribute { public: ReadTimeFormatLocalizationAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadTimeFormatLocalizationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeFormatLocalization AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeFormatLocalizationAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeTimeFormatLocalizationAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeTimeFormatLocalizationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadTimeFormatLocalizationEventList : public ReadAttribute { public: ReadTimeFormatLocalizationEventList() : ReadAttribute("event-list") { } ~ReadTimeFormatLocalizationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeFormatLocalization EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeFormatLocalizationEventList : public SubscribeAttribute { public: SubscribeAttributeTimeFormatLocalizationEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeTimeFormatLocalizationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadTimeFormatLocalizationAttributeList : public ReadAttribute { public: ReadTimeFormatLocalizationAttributeList() : ReadAttribute("attribute-list") { } ~ReadTimeFormatLocalizationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeFormatLocalization AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeFormatLocalizationAttributeList : public SubscribeAttribute { public: SubscribeAttributeTimeFormatLocalizationAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeTimeFormatLocalizationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadTimeFormatLocalizationFeatureMap : public ReadAttribute { public: ReadTimeFormatLocalizationFeatureMap() : ReadAttribute("feature-map") { } ~ReadTimeFormatLocalizationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeFormatLocalization FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeFormatLocalizationFeatureMap : public SubscribeAttribute { public: SubscribeAttributeTimeFormatLocalizationFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeTimeFormatLocalizationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadTimeFormatLocalizationClusterRevision : public ReadAttribute { public: ReadTimeFormatLocalizationClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadTimeFormatLocalizationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeFormatLocalization ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeFormatLocalizationClusterRevision : public SubscribeAttribute { public: SubscribeAttributeTimeFormatLocalizationClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeTimeFormatLocalizationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeFormatLocalization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeFormatLocalization::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeFormatLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster UnitLocalization | 0x002D | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * TemperatureUnit | 0x0000 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute TemperatureUnit */ class ReadUnitLocalizationTemperatureUnit : public ReadAttribute { public: ReadUnitLocalizationTemperatureUnit() : ReadAttribute("temperature-unit") { } ~ReadUnitLocalizationTemperatureUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitLocalization::Attributes::TemperatureUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTemperatureUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.TemperatureUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitLocalization TemperatureUnit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitLocalizationTemperatureUnit : public WriteAttribute { public: WriteUnitLocalizationTemperatureUnit() : WriteAttribute("temperature-unit") { AddArgument("attr-name", "temperature-unit"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitLocalizationTemperatureUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitLocalization::Attributes::TemperatureUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeTemperatureUnitWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitLocalization TemperatureUnit write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeUnitLocalizationTemperatureUnit : public SubscribeAttribute { public: SubscribeAttributeUnitLocalizationTemperatureUnit() : SubscribeAttribute("temperature-unit") { } ~SubscribeAttributeUnitLocalizationTemperatureUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitLocalization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitLocalization::Attributes::TemperatureUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTemperatureUnitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.TemperatureUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadUnitLocalizationGeneratedCommandList : public ReadAttribute { public: ReadUnitLocalizationGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadUnitLocalizationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitLocalization::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitLocalization GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUnitLocalizationGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeUnitLocalizationGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeUnitLocalizationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitLocalization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitLocalization::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadUnitLocalizationAcceptedCommandList : public ReadAttribute { public: ReadUnitLocalizationAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadUnitLocalizationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitLocalization::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitLocalization AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUnitLocalizationAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeUnitLocalizationAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeUnitLocalizationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitLocalization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitLocalization::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadUnitLocalizationEventList : public ReadAttribute { public: ReadUnitLocalizationEventList() : ReadAttribute("event-list") { } ~ReadUnitLocalizationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitLocalization::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitLocalization EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUnitLocalizationEventList : public SubscribeAttribute { public: SubscribeAttributeUnitLocalizationEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeUnitLocalizationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitLocalization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitLocalization::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadUnitLocalizationAttributeList : public ReadAttribute { public: ReadUnitLocalizationAttributeList() : ReadAttribute("attribute-list") { } ~ReadUnitLocalizationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitLocalization::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitLocalization AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUnitLocalizationAttributeList : public SubscribeAttribute { public: SubscribeAttributeUnitLocalizationAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeUnitLocalizationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitLocalization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitLocalization::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadUnitLocalizationFeatureMap : public ReadAttribute { public: ReadUnitLocalizationFeatureMap() : ReadAttribute("feature-map") { } ~ReadUnitLocalizationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitLocalization::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitLocalization FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUnitLocalizationFeatureMap : public SubscribeAttribute { public: SubscribeAttributeUnitLocalizationFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeUnitLocalizationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitLocalization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitLocalization::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadUnitLocalizationClusterRevision : public ReadAttribute { public: ReadUnitLocalizationClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadUnitLocalizationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitLocalization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitLocalization::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitLocalization ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUnitLocalizationClusterRevision : public SubscribeAttribute { public: SubscribeAttributeUnitLocalizationClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeUnitLocalizationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitLocalization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitLocalization::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitLocalization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster PowerSourceConfiguration | 0x002E | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * Sources | 0x0000 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute Sources */ class ReadPowerSourceConfigurationSources : public ReadAttribute { public: ReadPowerSourceConfigurationSources() : ReadAttribute("sources") { } ~ReadPowerSourceConfigurationSources() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSourceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSourceConfiguration::Attributes::Sources::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSourcesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.Sources response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSourceConfiguration Sources read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceConfigurationSources : public SubscribeAttribute { public: SubscribeAttributePowerSourceConfigurationSources() : SubscribeAttribute("sources") { } ~SubscribeAttributePowerSourceConfigurationSources() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSourceConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSourceConfiguration::Attributes::Sources::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSourcesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.Sources response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadPowerSourceConfigurationGeneratedCommandList : public ReadAttribute { public: ReadPowerSourceConfigurationGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadPowerSourceConfigurationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSourceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSourceConfiguration::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSourceConfiguration GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceConfigurationGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributePowerSourceConfigurationGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributePowerSourceConfigurationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSourceConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSourceConfiguration::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadPowerSourceConfigurationAcceptedCommandList : public ReadAttribute { public: ReadPowerSourceConfigurationAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadPowerSourceConfigurationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSourceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSourceConfiguration::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSourceConfiguration AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceConfigurationAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributePowerSourceConfigurationAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributePowerSourceConfigurationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSourceConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSourceConfiguration::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadPowerSourceConfigurationEventList : public ReadAttribute { public: ReadPowerSourceConfigurationEventList() : ReadAttribute("event-list") { } ~ReadPowerSourceConfigurationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSourceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSourceConfiguration::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSourceConfiguration EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceConfigurationEventList : public SubscribeAttribute { public: SubscribeAttributePowerSourceConfigurationEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributePowerSourceConfigurationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSourceConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSourceConfiguration::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadPowerSourceConfigurationAttributeList : public ReadAttribute { public: ReadPowerSourceConfigurationAttributeList() : ReadAttribute("attribute-list") { } ~ReadPowerSourceConfigurationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSourceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSourceConfiguration::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSourceConfiguration AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceConfigurationAttributeList : public SubscribeAttribute { public: SubscribeAttributePowerSourceConfigurationAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributePowerSourceConfigurationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSourceConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSourceConfiguration::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadPowerSourceConfigurationFeatureMap : public ReadAttribute { public: ReadPowerSourceConfigurationFeatureMap() : ReadAttribute("feature-map") { } ~ReadPowerSourceConfigurationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSourceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSourceConfiguration::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSourceConfiguration FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceConfigurationFeatureMap : public SubscribeAttribute { public: SubscribeAttributePowerSourceConfigurationFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributePowerSourceConfigurationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSourceConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSourceConfiguration::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadPowerSourceConfigurationClusterRevision : public ReadAttribute { public: ReadPowerSourceConfigurationClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadPowerSourceConfigurationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSourceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSourceConfiguration::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSourceConfiguration ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceConfigurationClusterRevision : public SubscribeAttribute { public: SubscribeAttributePowerSourceConfigurationClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributePowerSourceConfigurationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSourceConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSourceConfiguration::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSourceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster PowerSource | 0x002F | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * Status | 0x0000 | | * Order | 0x0001 | | * Description | 0x0002 | | * WiredAssessedInputVoltage | 0x0003 | | * WiredAssessedInputFrequency | 0x0004 | | * WiredCurrentType | 0x0005 | | * WiredAssessedCurrent | 0x0006 | | * WiredNominalVoltage | 0x0007 | | * WiredMaximumCurrent | 0x0008 | | * WiredPresent | 0x0009 | | * ActiveWiredFaults | 0x000A | | * BatVoltage | 0x000B | | * BatPercentRemaining | 0x000C | | * BatTimeRemaining | 0x000D | | * BatChargeLevel | 0x000E | | * BatReplacementNeeded | 0x000F | | * BatReplaceability | 0x0010 | | * BatPresent | 0x0011 | | * ActiveBatFaults | 0x0012 | | * BatReplacementDescription | 0x0013 | | * BatCommonDesignation | 0x0014 | | * BatANSIDesignation | 0x0015 | | * BatIECDesignation | 0x0016 | | * BatApprovedChemistry | 0x0017 | | * BatCapacity | 0x0018 | | * BatQuantity | 0x0019 | | * BatChargeState | 0x001A | | * BatTimeToFullCharge | 0x001B | | * BatFunctionalWhileCharging | 0x001C | | * BatChargingCurrent | 0x001D | | * ActiveBatChargeFaults | 0x001E | | * EndpointList | 0x001F | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * WiredFaultChange | 0x0000 | | * BatFaultChange | 0x0001 | | * BatChargeFaultChange | 0x0002 | \*----------------------------------------------------------------------------*/ /* * Attribute Status */ class ReadPowerSourceStatus : public ReadAttribute { public: ReadPowerSourceStatus() : ReadAttribute("status") { } ~ReadPowerSourceStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::Status::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.Status response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource Status read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceStatus : public SubscribeAttribute { public: SubscribeAttributePowerSourceStatus() : SubscribeAttribute("status") { } ~SubscribeAttributePowerSourceStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::Status::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStatusWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.Status response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Order */ class ReadPowerSourceOrder : public ReadAttribute { public: ReadPowerSourceOrder() : ReadAttribute("order") { } ~ReadPowerSourceOrder() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::Order::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOrderWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.Order response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource Order read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceOrder : public SubscribeAttribute { public: SubscribeAttributePowerSourceOrder() : SubscribeAttribute("order") { } ~SubscribeAttributePowerSourceOrder() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::Order::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOrderWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.Order response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Description */ class ReadPowerSourceDescription : public ReadAttribute { public: ReadPowerSourceDescription() : ReadAttribute("description") { } ~ReadPowerSourceDescription() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::Description::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDescriptionWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.Description response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource Description read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceDescription : public SubscribeAttribute { public: SubscribeAttributePowerSourceDescription() : SubscribeAttribute("description") { } ~SubscribeAttributePowerSourceDescription() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::Description::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDescriptionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.Description response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute WiredAssessedInputVoltage */ class ReadPowerSourceWiredAssessedInputVoltage : public ReadAttribute { public: ReadPowerSourceWiredAssessedInputVoltage() : ReadAttribute("wired-assessed-input-voltage") { } ~ReadPowerSourceWiredAssessedInputVoltage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::WiredAssessedInputVoltage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWiredAssessedInputVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.WiredAssessedInputVoltage response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource WiredAssessedInputVoltage read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceWiredAssessedInputVoltage : public SubscribeAttribute { public: SubscribeAttributePowerSourceWiredAssessedInputVoltage() : SubscribeAttribute("wired-assessed-input-voltage") { } ~SubscribeAttributePowerSourceWiredAssessedInputVoltage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::WiredAssessedInputVoltage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWiredAssessedInputVoltageWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.WiredAssessedInputVoltage response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute WiredAssessedInputFrequency */ class ReadPowerSourceWiredAssessedInputFrequency : public ReadAttribute { public: ReadPowerSourceWiredAssessedInputFrequency() : ReadAttribute("wired-assessed-input-frequency") { } ~ReadPowerSourceWiredAssessedInputFrequency() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::WiredAssessedInputFrequency::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWiredAssessedInputFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.WiredAssessedInputFrequency response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource WiredAssessedInputFrequency read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceWiredAssessedInputFrequency : public SubscribeAttribute { public: SubscribeAttributePowerSourceWiredAssessedInputFrequency() : SubscribeAttribute("wired-assessed-input-frequency") { } ~SubscribeAttributePowerSourceWiredAssessedInputFrequency() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::WiredAssessedInputFrequency::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWiredAssessedInputFrequencyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.WiredAssessedInputFrequency response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute WiredCurrentType */ class ReadPowerSourceWiredCurrentType : public ReadAttribute { public: ReadPowerSourceWiredCurrentType() : ReadAttribute("wired-current-type") { } ~ReadPowerSourceWiredCurrentType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::WiredCurrentType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWiredCurrentTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.WiredCurrentType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource WiredCurrentType read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceWiredCurrentType : public SubscribeAttribute { public: SubscribeAttributePowerSourceWiredCurrentType() : SubscribeAttribute("wired-current-type") { } ~SubscribeAttributePowerSourceWiredCurrentType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::WiredCurrentType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWiredCurrentTypeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.WiredCurrentType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute WiredAssessedCurrent */ class ReadPowerSourceWiredAssessedCurrent : public ReadAttribute { public: ReadPowerSourceWiredAssessedCurrent() : ReadAttribute("wired-assessed-current") { } ~ReadPowerSourceWiredAssessedCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::WiredAssessedCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWiredAssessedCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.WiredAssessedCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource WiredAssessedCurrent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceWiredAssessedCurrent : public SubscribeAttribute { public: SubscribeAttributePowerSourceWiredAssessedCurrent() : SubscribeAttribute("wired-assessed-current") { } ~SubscribeAttributePowerSourceWiredAssessedCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::WiredAssessedCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWiredAssessedCurrentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.WiredAssessedCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute WiredNominalVoltage */ class ReadPowerSourceWiredNominalVoltage : public ReadAttribute { public: ReadPowerSourceWiredNominalVoltage() : ReadAttribute("wired-nominal-voltage") { } ~ReadPowerSourceWiredNominalVoltage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::WiredNominalVoltage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWiredNominalVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.WiredNominalVoltage response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource WiredNominalVoltage read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceWiredNominalVoltage : public SubscribeAttribute { public: SubscribeAttributePowerSourceWiredNominalVoltage() : SubscribeAttribute("wired-nominal-voltage") { } ~SubscribeAttributePowerSourceWiredNominalVoltage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::WiredNominalVoltage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWiredNominalVoltageWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.WiredNominalVoltage response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute WiredMaximumCurrent */ class ReadPowerSourceWiredMaximumCurrent : public ReadAttribute { public: ReadPowerSourceWiredMaximumCurrent() : ReadAttribute("wired-maximum-current") { } ~ReadPowerSourceWiredMaximumCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::WiredMaximumCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWiredMaximumCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.WiredMaximumCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource WiredMaximumCurrent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceWiredMaximumCurrent : public SubscribeAttribute { public: SubscribeAttributePowerSourceWiredMaximumCurrent() : SubscribeAttribute("wired-maximum-current") { } ~SubscribeAttributePowerSourceWiredMaximumCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::WiredMaximumCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWiredMaximumCurrentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.WiredMaximumCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute WiredPresent */ class ReadPowerSourceWiredPresent : public ReadAttribute { public: ReadPowerSourceWiredPresent() : ReadAttribute("wired-present") { } ~ReadPowerSourceWiredPresent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::WiredPresent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWiredPresentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.WiredPresent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource WiredPresent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceWiredPresent : public SubscribeAttribute { public: SubscribeAttributePowerSourceWiredPresent() : SubscribeAttribute("wired-present") { } ~SubscribeAttributePowerSourceWiredPresent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::WiredPresent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWiredPresentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.WiredPresent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ActiveWiredFaults */ class ReadPowerSourceActiveWiredFaults : public ReadAttribute { public: ReadPowerSourceActiveWiredFaults() : ReadAttribute("active-wired-faults") { } ~ReadPowerSourceActiveWiredFaults() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::ActiveWiredFaults::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveWiredFaultsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.ActiveWiredFaults response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource ActiveWiredFaults read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceActiveWiredFaults : public SubscribeAttribute { public: SubscribeAttributePowerSourceActiveWiredFaults() : SubscribeAttribute("active-wired-faults") { } ~SubscribeAttributePowerSourceActiveWiredFaults() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::ActiveWiredFaults::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveWiredFaultsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.ActiveWiredFaults response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatVoltage */ class ReadPowerSourceBatVoltage : public ReadAttribute { public: ReadPowerSourceBatVoltage() : ReadAttribute("bat-voltage") { } ~ReadPowerSourceBatVoltage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatVoltage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatVoltage response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatVoltage read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatVoltage : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatVoltage() : SubscribeAttribute("bat-voltage") { } ~SubscribeAttributePowerSourceBatVoltage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatVoltage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatVoltageWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatVoltage response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatPercentRemaining */ class ReadPowerSourceBatPercentRemaining : public ReadAttribute { public: ReadPowerSourceBatPercentRemaining() : ReadAttribute("bat-percent-remaining") { } ~ReadPowerSourceBatPercentRemaining() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatPercentRemaining::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatPercentRemainingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatPercentRemaining response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatPercentRemaining read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatPercentRemaining : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatPercentRemaining() : SubscribeAttribute("bat-percent-remaining") { } ~SubscribeAttributePowerSourceBatPercentRemaining() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatPercentRemaining::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatPercentRemainingWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatPercentRemaining response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatTimeRemaining */ class ReadPowerSourceBatTimeRemaining : public ReadAttribute { public: ReadPowerSourceBatTimeRemaining() : ReadAttribute("bat-time-remaining") { } ~ReadPowerSourceBatTimeRemaining() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatTimeRemaining::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatTimeRemainingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatTimeRemaining response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatTimeRemaining read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatTimeRemaining : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatTimeRemaining() : SubscribeAttribute("bat-time-remaining") { } ~SubscribeAttributePowerSourceBatTimeRemaining() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatTimeRemaining::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatTimeRemainingWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatTimeRemaining response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatChargeLevel */ class ReadPowerSourceBatChargeLevel : public ReadAttribute { public: ReadPowerSourceBatChargeLevel() : ReadAttribute("bat-charge-level") { } ~ReadPowerSourceBatChargeLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatChargeLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatChargeLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatChargeLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatChargeLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatChargeLevel : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatChargeLevel() : SubscribeAttribute("bat-charge-level") { } ~SubscribeAttributePowerSourceBatChargeLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatChargeLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatChargeLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatChargeLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatReplacementNeeded */ class ReadPowerSourceBatReplacementNeeded : public ReadAttribute { public: ReadPowerSourceBatReplacementNeeded() : ReadAttribute("bat-replacement-needed") { } ~ReadPowerSourceBatReplacementNeeded() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatReplacementNeeded::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatReplacementNeededWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatReplacementNeeded response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatReplacementNeeded read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatReplacementNeeded : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatReplacementNeeded() : SubscribeAttribute("bat-replacement-needed") { } ~SubscribeAttributePowerSourceBatReplacementNeeded() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatReplacementNeeded::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatReplacementNeededWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatReplacementNeeded response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatReplaceability */ class ReadPowerSourceBatReplaceability : public ReadAttribute { public: ReadPowerSourceBatReplaceability() : ReadAttribute("bat-replaceability") { } ~ReadPowerSourceBatReplaceability() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatReplaceability::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatReplaceabilityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatReplaceability response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatReplaceability read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatReplaceability : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatReplaceability() : SubscribeAttribute("bat-replaceability") { } ~SubscribeAttributePowerSourceBatReplaceability() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatReplaceability::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatReplaceabilityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatReplaceability response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatPresent */ class ReadPowerSourceBatPresent : public ReadAttribute { public: ReadPowerSourceBatPresent() : ReadAttribute("bat-present") { } ~ReadPowerSourceBatPresent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatPresent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatPresentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatPresent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatPresent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatPresent : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatPresent() : SubscribeAttribute("bat-present") { } ~SubscribeAttributePowerSourceBatPresent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatPresent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatPresentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatPresent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ActiveBatFaults */ class ReadPowerSourceActiveBatFaults : public ReadAttribute { public: ReadPowerSourceActiveBatFaults() : ReadAttribute("active-bat-faults") { } ~ReadPowerSourceActiveBatFaults() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::ActiveBatFaults::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveBatFaultsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.ActiveBatFaults response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource ActiveBatFaults read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceActiveBatFaults : public SubscribeAttribute { public: SubscribeAttributePowerSourceActiveBatFaults() : SubscribeAttribute("active-bat-faults") { } ~SubscribeAttributePowerSourceActiveBatFaults() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::ActiveBatFaults::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveBatFaultsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.ActiveBatFaults response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatReplacementDescription */ class ReadPowerSourceBatReplacementDescription : public ReadAttribute { public: ReadPowerSourceBatReplacementDescription() : ReadAttribute("bat-replacement-description") { } ~ReadPowerSourceBatReplacementDescription() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatReplacementDescription::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatReplacementDescriptionWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatReplacementDescription response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatReplacementDescription read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatReplacementDescription : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatReplacementDescription() : SubscribeAttribute("bat-replacement-description") { } ~SubscribeAttributePowerSourceBatReplacementDescription() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatReplacementDescription::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatReplacementDescriptionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatReplacementDescription response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatCommonDesignation */ class ReadPowerSourceBatCommonDesignation : public ReadAttribute { public: ReadPowerSourceBatCommonDesignation() : ReadAttribute("bat-common-designation") { } ~ReadPowerSourceBatCommonDesignation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatCommonDesignation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatCommonDesignationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatCommonDesignation response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatCommonDesignation read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatCommonDesignation : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatCommonDesignation() : SubscribeAttribute("bat-common-designation") { } ~SubscribeAttributePowerSourceBatCommonDesignation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatCommonDesignation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatCommonDesignationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatCommonDesignation response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatANSIDesignation */ class ReadPowerSourceBatANSIDesignation : public ReadAttribute { public: ReadPowerSourceBatANSIDesignation() : ReadAttribute("bat-ansidesignation") { } ~ReadPowerSourceBatANSIDesignation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatANSIDesignation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatANSIDesignationWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatANSIDesignation response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatANSIDesignation read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatANSIDesignation : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatANSIDesignation() : SubscribeAttribute("bat-ansidesignation") { } ~SubscribeAttributePowerSourceBatANSIDesignation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatANSIDesignation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatANSIDesignationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatANSIDesignation response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatIECDesignation */ class ReadPowerSourceBatIECDesignation : public ReadAttribute { public: ReadPowerSourceBatIECDesignation() : ReadAttribute("bat-iecdesignation") { } ~ReadPowerSourceBatIECDesignation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatIECDesignation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatIECDesignationWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatIECDesignation response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatIECDesignation read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatIECDesignation : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatIECDesignation() : SubscribeAttribute("bat-iecdesignation") { } ~SubscribeAttributePowerSourceBatIECDesignation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatIECDesignation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatIECDesignationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatIECDesignation response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatApprovedChemistry */ class ReadPowerSourceBatApprovedChemistry : public ReadAttribute { public: ReadPowerSourceBatApprovedChemistry() : ReadAttribute("bat-approved-chemistry") { } ~ReadPowerSourceBatApprovedChemistry() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatApprovedChemistry::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatApprovedChemistryWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatApprovedChemistry response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatApprovedChemistry read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatApprovedChemistry : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatApprovedChemistry() : SubscribeAttribute("bat-approved-chemistry") { } ~SubscribeAttributePowerSourceBatApprovedChemistry() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatApprovedChemistry::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatApprovedChemistryWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatApprovedChemistry response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatCapacity */ class ReadPowerSourceBatCapacity : public ReadAttribute { public: ReadPowerSourceBatCapacity() : ReadAttribute("bat-capacity") { } ~ReadPowerSourceBatCapacity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatCapacity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatCapacityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatCapacity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatCapacity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatCapacity : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatCapacity() : SubscribeAttribute("bat-capacity") { } ~SubscribeAttributePowerSourceBatCapacity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatCapacity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatCapacityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatCapacity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatQuantity */ class ReadPowerSourceBatQuantity : public ReadAttribute { public: ReadPowerSourceBatQuantity() : ReadAttribute("bat-quantity") { } ~ReadPowerSourceBatQuantity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatQuantity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatQuantityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatQuantity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatQuantity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatQuantity : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatQuantity() : SubscribeAttribute("bat-quantity") { } ~SubscribeAttributePowerSourceBatQuantity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatQuantity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatQuantityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatQuantity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatChargeState */ class ReadPowerSourceBatChargeState : public ReadAttribute { public: ReadPowerSourceBatChargeState() : ReadAttribute("bat-charge-state") { } ~ReadPowerSourceBatChargeState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatChargeState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatChargeStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatChargeState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatChargeState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatChargeState : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatChargeState() : SubscribeAttribute("bat-charge-state") { } ~SubscribeAttributePowerSourceBatChargeState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatChargeState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatChargeStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatChargeState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatTimeToFullCharge */ class ReadPowerSourceBatTimeToFullCharge : public ReadAttribute { public: ReadPowerSourceBatTimeToFullCharge() : ReadAttribute("bat-time-to-full-charge") { } ~ReadPowerSourceBatTimeToFullCharge() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatTimeToFullCharge::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatTimeToFullChargeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatTimeToFullCharge response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatTimeToFullCharge read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatTimeToFullCharge : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatTimeToFullCharge() : SubscribeAttribute("bat-time-to-full-charge") { } ~SubscribeAttributePowerSourceBatTimeToFullCharge() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatTimeToFullCharge::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatTimeToFullChargeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatTimeToFullCharge response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatFunctionalWhileCharging */ class ReadPowerSourceBatFunctionalWhileCharging : public ReadAttribute { public: ReadPowerSourceBatFunctionalWhileCharging() : ReadAttribute("bat-functional-while-charging") { } ~ReadPowerSourceBatFunctionalWhileCharging() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatFunctionalWhileCharging::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatFunctionalWhileChargingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatFunctionalWhileCharging response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatFunctionalWhileCharging read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatFunctionalWhileCharging : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatFunctionalWhileCharging() : SubscribeAttribute("bat-functional-while-charging") { } ~SubscribeAttributePowerSourceBatFunctionalWhileCharging() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatFunctionalWhileCharging::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatFunctionalWhileChargingWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatFunctionalWhileCharging response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatChargingCurrent */ class ReadPowerSourceBatChargingCurrent : public ReadAttribute { public: ReadPowerSourceBatChargingCurrent() : ReadAttribute("bat-charging-current") { } ~ReadPowerSourceBatChargingCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::BatChargingCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatChargingCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatChargingCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource BatChargingCurrent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceBatChargingCurrent : public SubscribeAttribute { public: SubscribeAttributePowerSourceBatChargingCurrent() : SubscribeAttribute("bat-charging-current") { } ~SubscribeAttributePowerSourceBatChargingCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::BatChargingCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatChargingCurrentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatChargingCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ActiveBatChargeFaults */ class ReadPowerSourceActiveBatChargeFaults : public ReadAttribute { public: ReadPowerSourceActiveBatChargeFaults() : ReadAttribute("active-bat-charge-faults") { } ~ReadPowerSourceActiveBatChargeFaults() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::ActiveBatChargeFaults::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveBatChargeFaultsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.ActiveBatChargeFaults response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource ActiveBatChargeFaults read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceActiveBatChargeFaults : public SubscribeAttribute { public: SubscribeAttributePowerSourceActiveBatChargeFaults() : SubscribeAttribute("active-bat-charge-faults") { } ~SubscribeAttributePowerSourceActiveBatChargeFaults() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::ActiveBatChargeFaults::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveBatChargeFaultsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.ActiveBatChargeFaults response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute EndpointList */ class ReadPowerSourceEndpointList : public ReadAttribute { public: ReadPowerSourceEndpointList() : ReadAttribute("endpoint-list") { } ~ReadPowerSourceEndpointList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::EndpointList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEndpointListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.EndpointList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource EndpointList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceEndpointList : public SubscribeAttribute { public: SubscribeAttributePowerSourceEndpointList() : SubscribeAttribute("endpoint-list") { } ~SubscribeAttributePowerSourceEndpointList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::EndpointList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEndpointListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.EndpointList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadPowerSourceGeneratedCommandList : public ReadAttribute { public: ReadPowerSourceGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadPowerSourceGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributePowerSourceGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributePowerSourceGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadPowerSourceAcceptedCommandList : public ReadAttribute { public: ReadPowerSourceAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadPowerSourceAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributePowerSourceAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributePowerSourceAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadPowerSourceEventList : public ReadAttribute { public: ReadPowerSourceEventList() : ReadAttribute("event-list") { } ~ReadPowerSourceEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceEventList : public SubscribeAttribute { public: SubscribeAttributePowerSourceEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributePowerSourceEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadPowerSourceAttributeList : public ReadAttribute { public: ReadPowerSourceAttributeList() : ReadAttribute("attribute-list") { } ~ReadPowerSourceAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceAttributeList : public SubscribeAttribute { public: SubscribeAttributePowerSourceAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributePowerSourceAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadPowerSourceFeatureMap : public ReadAttribute { public: ReadPowerSourceFeatureMap() : ReadAttribute("feature-map") { } ~ReadPowerSourceFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceFeatureMap : public SubscribeAttribute { public: SubscribeAttributePowerSourceFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributePowerSourceFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadPowerSourceClusterRevision : public ReadAttribute { public: ReadPowerSourceClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadPowerSourceClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerSource::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerSource ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerSourceClusterRevision : public SubscribeAttribute { public: SubscribeAttributePowerSourceClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributePowerSourceClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerSource::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerSource::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerSource alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster GeneralCommissioning | 0x0030 | |------------------------------------------------------------------------------| | Commands: | | | * ArmFailSafe | 0x00 | | * SetRegulatoryConfig | 0x02 | | * CommissioningComplete | 0x04 | | * SetTCAcknowledgements | 0x06 | |------------------------------------------------------------------------------| | Attributes: | | | * Breadcrumb | 0x0000 | | * BasicCommissioningInfo | 0x0001 | | * RegulatoryConfig | 0x0002 | | * LocationCapability | 0x0003 | | * SupportsConcurrentConnection | 0x0004 | | * TCAcceptedVersion | 0x0005 | | * TCMinRequiredVersion | 0x0006 | | * TCAcknowledgements | 0x0007 | | * TCAcknowledgementsRequired | 0x0008 | | * TCUpdateDeadline | 0x0009 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command ArmFailSafe */ class GeneralCommissioningArmFailSafe : public ClusterCommand { public: GeneralCommissioningArmFailSafe() : ClusterCommand("arm-fail-safe") { AddArgument("ExpiryLengthSeconds", 0, UINT16_MAX, &mRequest.expiryLengthSeconds); AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId commandId = chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGeneralCommissioningClusterArmFailSafeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.expiryLengthSeconds = [NSNumber numberWithUnsignedShort:mRequest.expiryLengthSeconds]; params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster armFailSafeWithParams:params completion: ^(MTRGeneralCommissioningClusterArmFailSafeResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafeResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::GeneralCommissioning::Commands::ArmFailSafe::Type mRequest; }; /* * Command SetRegulatoryConfig */ class GeneralCommissioningSetRegulatoryConfig : public ClusterCommand { public: GeneralCommissioningSetRegulatoryConfig() : ClusterCommand("set-regulatory-config") { AddArgument("NewRegulatoryConfig", 0, UINT8_MAX, &mRequest.newRegulatoryConfig); AddArgument("CountryCode", &mRequest.countryCode); AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId commandId = chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfig::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGeneralCommissioningClusterSetRegulatoryConfigParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.newRegulatoryConfig = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.newRegulatoryConfig)]; params.countryCode = [[NSString alloc] initWithBytes:mRequest.countryCode.data() length:mRequest.countryCode.size() encoding:NSUTF8StringEncoding]; params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setRegulatoryConfigWithParams:params completion: ^(MTRGeneralCommissioningClusterSetRegulatoryConfigResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfigResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfigResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::GeneralCommissioning::Commands::SetRegulatoryConfig::Type mRequest; }; /* * Command CommissioningComplete */ class GeneralCommissioningCommissioningComplete : public ClusterCommand { public: GeneralCommissioningCommissioningComplete() : ClusterCommand("commissioning-complete") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId commandId = chip::app::Clusters::GeneralCommissioning::Commands::CommissioningComplete::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGeneralCommissioningClusterCommissioningCompleteParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster commissioningCompleteWithParams:params completion: ^(MTRGeneralCommissioningClusterCommissioningCompleteResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::GeneralCommissioning::Commands::CommissioningCompleteResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::GeneralCommissioning::Commands::CommissioningCompleteResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #if MTR_ENABLE_PROVISIONAL /* * Command SetTCAcknowledgements */ class GeneralCommissioningSetTCAcknowledgements : public ClusterCommand { public: GeneralCommissioningSetTCAcknowledgements() : ClusterCommand("set-tcacknowledgements") { #if MTR_ENABLE_PROVISIONAL AddArgument("TCVersion", 0, UINT16_MAX, &mRequest.TCVersion); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("TCUserResponse", 0, UINT16_MAX, &mRequest.TCUserResponse); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId commandId = chip::app::Clusters::GeneralCommissioning::Commands::SetTCAcknowledgements::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGeneralCommissioningClusterSetTCAcknowledgementsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.tcVersion = [NSNumber numberWithUnsignedShort:mRequest.TCVersion]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.tcUserResponse = [NSNumber numberWithUnsignedShort:mRequest.TCUserResponse]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setTCAcknowledgementsWithParams:params completion: ^(MTRGeneralCommissioningClusterSetTCAcknowledgementsResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::GeneralCommissioning::Commands::SetTCAcknowledgementsResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::GeneralCommissioning::Commands::SetTCAcknowledgementsResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::GeneralCommissioning::Commands::SetTCAcknowledgements::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute Breadcrumb */ class ReadGeneralCommissioningBreadcrumb : public ReadAttribute { public: ReadGeneralCommissioningBreadcrumb() : ReadAttribute("breadcrumb") { } ~ReadGeneralCommissioningBreadcrumb() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::Breadcrumb::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBreadcrumbWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.Breadcrumb response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralCommissioning Breadcrumb read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteGeneralCommissioningBreadcrumb : public WriteAttribute { public: WriteGeneralCommissioningBreadcrumb() : WriteAttribute("breadcrumb") { AddArgument("attr-name", "breadcrumb"); AddArgument("attr-value", 0, UINT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteGeneralCommissioningBreadcrumb() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::Breadcrumb::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; [cluster writeAttributeBreadcrumbWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("GeneralCommissioning Breadcrumb write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint64_t mValue; }; class SubscribeAttributeGeneralCommissioningBreadcrumb : public SubscribeAttribute { public: SubscribeAttributeGeneralCommissioningBreadcrumb() : SubscribeAttribute("breadcrumb") { } ~SubscribeAttributeGeneralCommissioningBreadcrumb() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::Breadcrumb::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBreadcrumbWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.Breadcrumb response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BasicCommissioningInfo */ class ReadGeneralCommissioningBasicCommissioningInfo : public ReadAttribute { public: ReadGeneralCommissioningBasicCommissioningInfo() : ReadAttribute("basic-commissioning-info") { } ~ReadGeneralCommissioningBasicCommissioningInfo() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::BasicCommissioningInfo::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBasicCommissioningInfoWithCompletion:^(MTRGeneralCommissioningClusterBasicCommissioningInfo * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.BasicCommissioningInfo response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralCommissioning BasicCommissioningInfo read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralCommissioningBasicCommissioningInfo : public SubscribeAttribute { public: SubscribeAttributeGeneralCommissioningBasicCommissioningInfo() : SubscribeAttribute("basic-commissioning-info") { } ~SubscribeAttributeGeneralCommissioningBasicCommissioningInfo() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::BasicCommissioningInfo::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBasicCommissioningInfoWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRGeneralCommissioningClusterBasicCommissioningInfo * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.BasicCommissioningInfo response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RegulatoryConfig */ class ReadGeneralCommissioningRegulatoryConfig : public ReadAttribute { public: ReadGeneralCommissioningRegulatoryConfig() : ReadAttribute("regulatory-config") { } ~ReadGeneralCommissioningRegulatoryConfig() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::RegulatoryConfig::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRegulatoryConfigWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.RegulatoryConfig response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralCommissioning RegulatoryConfig read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralCommissioningRegulatoryConfig : public SubscribeAttribute { public: SubscribeAttributeGeneralCommissioningRegulatoryConfig() : SubscribeAttribute("regulatory-config") { } ~SubscribeAttributeGeneralCommissioningRegulatoryConfig() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::RegulatoryConfig::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRegulatoryConfigWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.RegulatoryConfig response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LocationCapability */ class ReadGeneralCommissioningLocationCapability : public ReadAttribute { public: ReadGeneralCommissioningLocationCapability() : ReadAttribute("location-capability") { } ~ReadGeneralCommissioningLocationCapability() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::LocationCapability::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLocationCapabilityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.LocationCapability response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralCommissioning LocationCapability read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralCommissioningLocationCapability : public SubscribeAttribute { public: SubscribeAttributeGeneralCommissioningLocationCapability() : SubscribeAttribute("location-capability") { } ~SubscribeAttributeGeneralCommissioningLocationCapability() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::LocationCapability::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLocationCapabilityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.LocationCapability response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SupportsConcurrentConnection */ class ReadGeneralCommissioningSupportsConcurrentConnection : public ReadAttribute { public: ReadGeneralCommissioningSupportsConcurrentConnection() : ReadAttribute("supports-concurrent-connection") { } ~ReadGeneralCommissioningSupportsConcurrentConnection() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::SupportsConcurrentConnection::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportsConcurrentConnectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.SupportsConcurrentConnection response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralCommissioning SupportsConcurrentConnection read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralCommissioningSupportsConcurrentConnection : public SubscribeAttribute { public: SubscribeAttributeGeneralCommissioningSupportsConcurrentConnection() : SubscribeAttribute("supports-concurrent-connection") { } ~SubscribeAttributeGeneralCommissioningSupportsConcurrentConnection() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::SupportsConcurrentConnection::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportsConcurrentConnectionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.SupportsConcurrentConnection response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute TCAcceptedVersion */ class ReadGeneralCommissioningTCAcceptedVersion : public ReadAttribute { public: ReadGeneralCommissioningTCAcceptedVersion() : ReadAttribute("tcaccepted-version") { } ~ReadGeneralCommissioningTCAcceptedVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::TCAcceptedVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTCAcceptedVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.TCAcceptedVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralCommissioning TCAcceptedVersion read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralCommissioningTCAcceptedVersion : public SubscribeAttribute { public: SubscribeAttributeGeneralCommissioningTCAcceptedVersion() : SubscribeAttribute("tcaccepted-version") { } ~SubscribeAttributeGeneralCommissioningTCAcceptedVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::TCAcceptedVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTCAcceptedVersionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.TCAcceptedVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute TCMinRequiredVersion */ class ReadGeneralCommissioningTCMinRequiredVersion : public ReadAttribute { public: ReadGeneralCommissioningTCMinRequiredVersion() : ReadAttribute("tcmin-required-version") { } ~ReadGeneralCommissioningTCMinRequiredVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::TCMinRequiredVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTCMinRequiredVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.TCMinRequiredVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralCommissioning TCMinRequiredVersion read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralCommissioningTCMinRequiredVersion : public SubscribeAttribute { public: SubscribeAttributeGeneralCommissioningTCMinRequiredVersion() : SubscribeAttribute("tcmin-required-version") { } ~SubscribeAttributeGeneralCommissioningTCMinRequiredVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::TCMinRequiredVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTCMinRequiredVersionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.TCMinRequiredVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute TCAcknowledgements */ class ReadGeneralCommissioningTCAcknowledgements : public ReadAttribute { public: ReadGeneralCommissioningTCAcknowledgements() : ReadAttribute("tcacknowledgements") { } ~ReadGeneralCommissioningTCAcknowledgements() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::TCAcknowledgements::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTCAcknowledgementsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.TCAcknowledgements response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralCommissioning TCAcknowledgements read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralCommissioningTCAcknowledgements : public SubscribeAttribute { public: SubscribeAttributeGeneralCommissioningTCAcknowledgements() : SubscribeAttribute("tcacknowledgements") { } ~SubscribeAttributeGeneralCommissioningTCAcknowledgements() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::TCAcknowledgements::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTCAcknowledgementsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.TCAcknowledgements response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute TCAcknowledgementsRequired */ class ReadGeneralCommissioningTCAcknowledgementsRequired : public ReadAttribute { public: ReadGeneralCommissioningTCAcknowledgementsRequired() : ReadAttribute("tcacknowledgements-required") { } ~ReadGeneralCommissioningTCAcknowledgementsRequired() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::TCAcknowledgementsRequired::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTCAcknowledgementsRequiredWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.TCAcknowledgementsRequired response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralCommissioning TCAcknowledgementsRequired read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralCommissioningTCAcknowledgementsRequired : public SubscribeAttribute { public: SubscribeAttributeGeneralCommissioningTCAcknowledgementsRequired() : SubscribeAttribute("tcacknowledgements-required") { } ~SubscribeAttributeGeneralCommissioningTCAcknowledgementsRequired() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::TCAcknowledgementsRequired::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTCAcknowledgementsRequiredWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.TCAcknowledgementsRequired response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute TCUpdateDeadline */ class ReadGeneralCommissioningTCUpdateDeadline : public ReadAttribute { public: ReadGeneralCommissioningTCUpdateDeadline() : ReadAttribute("tcupdate-deadline") { } ~ReadGeneralCommissioningTCUpdateDeadline() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::TCUpdateDeadline::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTCUpdateDeadlineWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.TCUpdateDeadline response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralCommissioning TCUpdateDeadline read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralCommissioningTCUpdateDeadline : public SubscribeAttribute { public: SubscribeAttributeGeneralCommissioningTCUpdateDeadline() : SubscribeAttribute("tcupdate-deadline") { } ~SubscribeAttributeGeneralCommissioningTCUpdateDeadline() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::TCUpdateDeadline::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTCUpdateDeadlineWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.TCUpdateDeadline response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadGeneralCommissioningGeneratedCommandList : public ReadAttribute { public: ReadGeneralCommissioningGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadGeneralCommissioningGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralCommissioning GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralCommissioningGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeGeneralCommissioningGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeGeneralCommissioningGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadGeneralCommissioningAcceptedCommandList : public ReadAttribute { public: ReadGeneralCommissioningAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadGeneralCommissioningAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralCommissioning AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralCommissioningAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeGeneralCommissioningAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeGeneralCommissioningAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadGeneralCommissioningEventList : public ReadAttribute { public: ReadGeneralCommissioningEventList() : ReadAttribute("event-list") { } ~ReadGeneralCommissioningEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralCommissioning EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralCommissioningEventList : public SubscribeAttribute { public: SubscribeAttributeGeneralCommissioningEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeGeneralCommissioningEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadGeneralCommissioningAttributeList : public ReadAttribute { public: ReadGeneralCommissioningAttributeList() : ReadAttribute("attribute-list") { } ~ReadGeneralCommissioningAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralCommissioning AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralCommissioningAttributeList : public SubscribeAttribute { public: SubscribeAttributeGeneralCommissioningAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeGeneralCommissioningAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadGeneralCommissioningFeatureMap : public ReadAttribute { public: ReadGeneralCommissioningFeatureMap() : ReadAttribute("feature-map") { } ~ReadGeneralCommissioningFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralCommissioning FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralCommissioningFeatureMap : public SubscribeAttribute { public: SubscribeAttributeGeneralCommissioningFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeGeneralCommissioningFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadGeneralCommissioningClusterRevision : public ReadAttribute { public: ReadGeneralCommissioningClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadGeneralCommissioningClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralCommissioning ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralCommissioningClusterRevision : public SubscribeAttribute { public: SubscribeAttributeGeneralCommissioningClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeGeneralCommissioningClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralCommissioning::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster NetworkCommissioning | 0x0031 | |------------------------------------------------------------------------------| | Commands: | | | * ScanNetworks | 0x00 | | * AddOrUpdateWiFiNetwork | 0x02 | | * AddOrUpdateThreadNetwork | 0x03 | | * RemoveNetwork | 0x04 | | * ConnectNetwork | 0x06 | | * ReorderNetwork | 0x08 | | * QueryIdentity | 0x09 | |------------------------------------------------------------------------------| | Attributes: | | | * MaxNetworks | 0x0000 | | * Networks | 0x0001 | | * ScanMaxTimeSeconds | 0x0002 | | * ConnectMaxTimeSeconds | 0x0003 | | * InterfaceEnabled | 0x0004 | | * LastNetworkingStatus | 0x0005 | | * LastNetworkID | 0x0006 | | * LastConnectErrorValue | 0x0007 | | * SupportedWiFiBands | 0x0008 | | * SupportedThreadFeatures | 0x0009 | | * ThreadVersion | 0x000A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command ScanNetworks */ class NetworkCommissioningScanNetworks : public ClusterCommand { public: NetworkCommissioningScanNetworks() : ClusterCommand("scan-networks") { AddArgument("Ssid", &mRequest.ssid); AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId commandId = chip::app::Clusters::NetworkCommissioning::Commands::ScanNetworks::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRNetworkCommissioningClusterScanNetworksParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; if (mRequest.ssid.HasValue()) { if (mRequest.ssid.Value().IsNull()) { params.ssid = nil; } else { params.ssid = [NSData dataWithBytes:mRequest.ssid.Value().Value().data() length:mRequest.ssid.Value().Value().size()]; } } else { params.ssid = nil; } if (mRequest.breadcrumb.HasValue()) { params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; } else { params.breadcrumb = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster scanNetworksWithParams:params completion: ^(MTRNetworkCommissioningClusterScanNetworksResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::NetworkCommissioning::Commands::ScanNetworksResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::NetworkCommissioning::Commands::ScanNetworksResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::NetworkCommissioning::Commands::ScanNetworks::Type mRequest; }; /* * Command AddOrUpdateWiFiNetwork */ class NetworkCommissioningAddOrUpdateWiFiNetwork : public ClusterCommand { public: NetworkCommissioningAddOrUpdateWiFiNetwork() : ClusterCommand("add-or-update-wi-fi-network") { AddArgument("Ssid", &mRequest.ssid); AddArgument("Credentials", &mRequest.credentials); AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); #if MTR_ENABLE_PROVISIONAL AddArgument("NetworkIdentity", &mRequest.networkIdentity); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ClientIdentifier", &mRequest.clientIdentifier); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("PossessionNonce", &mRequest.possessionNonce); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId commandId = chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateWiFiNetwork::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRNetworkCommissioningClusterAddOrUpdateWiFiNetworkParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.ssid = [NSData dataWithBytes:mRequest.ssid.data() length:mRequest.ssid.size()]; params.credentials = [NSData dataWithBytes:mRequest.credentials.data() length:mRequest.credentials.size()]; if (mRequest.breadcrumb.HasValue()) { params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; } else { params.breadcrumb = nil; } #if MTR_ENABLE_PROVISIONAL if (mRequest.networkIdentity.HasValue()) { params.networkIdentity = [NSData dataWithBytes:mRequest.networkIdentity.Value().data() length:mRequest.networkIdentity.Value().size()]; } else { params.networkIdentity = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.clientIdentifier.HasValue()) { params.clientIdentifier = [NSData dataWithBytes:mRequest.clientIdentifier.Value().data() length:mRequest.clientIdentifier.Value().size()]; } else { params.clientIdentifier = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.possessionNonce.HasValue()) { params.possessionNonce = [NSData dataWithBytes:mRequest.possessionNonce.Value().data() length:mRequest.possessionNonce.Value().size()]; } else { params.possessionNonce = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster addOrUpdateWiFiNetworkWithParams:params completion: ^(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::NetworkCommissioning::Commands::NetworkConfigResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::NetworkCommissioning::Commands::NetworkConfigResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateWiFiNetwork::Type mRequest; }; /* * Command AddOrUpdateThreadNetwork */ class NetworkCommissioningAddOrUpdateThreadNetwork : public ClusterCommand { public: NetworkCommissioningAddOrUpdateThreadNetwork() : ClusterCommand("add-or-update-thread-network") { AddArgument("OperationalDataset", &mRequest.operationalDataset); AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId commandId = chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateThreadNetwork::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRNetworkCommissioningClusterAddOrUpdateThreadNetworkParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.operationalDataset = [NSData dataWithBytes:mRequest.operationalDataset.data() length:mRequest.operationalDataset.size()]; if (mRequest.breadcrumb.HasValue()) { params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; } else { params.breadcrumb = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster addOrUpdateThreadNetworkWithParams:params completion: ^(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::NetworkCommissioning::Commands::NetworkConfigResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::NetworkCommissioning::Commands::NetworkConfigResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::NetworkCommissioning::Commands::AddOrUpdateThreadNetwork::Type mRequest; }; /* * Command RemoveNetwork */ class NetworkCommissioningRemoveNetwork : public ClusterCommand { public: NetworkCommissioningRemoveNetwork() : ClusterCommand("remove-network") { AddArgument("NetworkID", &mRequest.networkID); AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId commandId = chip::app::Clusters::NetworkCommissioning::Commands::RemoveNetwork::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRNetworkCommissioningClusterRemoveNetworkParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.networkID = [NSData dataWithBytes:mRequest.networkID.data() length:mRequest.networkID.size()]; if (mRequest.breadcrumb.HasValue()) { params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; } else { params.breadcrumb = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster removeNetworkWithParams:params completion: ^(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::NetworkCommissioning::Commands::NetworkConfigResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::NetworkCommissioning::Commands::NetworkConfigResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::NetworkCommissioning::Commands::RemoveNetwork::Type mRequest; }; /* * Command ConnectNetwork */ class NetworkCommissioningConnectNetwork : public ClusterCommand { public: NetworkCommissioningConnectNetwork() : ClusterCommand("connect-network") { AddArgument("NetworkID", &mRequest.networkID); AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId commandId = chip::app::Clusters::NetworkCommissioning::Commands::ConnectNetwork::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRNetworkCommissioningClusterConnectNetworkParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.networkID = [NSData dataWithBytes:mRequest.networkID.data() length:mRequest.networkID.size()]; if (mRequest.breadcrumb.HasValue()) { params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; } else { params.breadcrumb = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster connectNetworkWithParams:params completion: ^(MTRNetworkCommissioningClusterConnectNetworkResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::NetworkCommissioning::Commands::ConnectNetworkResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::NetworkCommissioning::Commands::ConnectNetworkResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::NetworkCommissioning::Commands::ConnectNetwork::Type mRequest; }; /* * Command ReorderNetwork */ class NetworkCommissioningReorderNetwork : public ClusterCommand { public: NetworkCommissioningReorderNetwork() : ClusterCommand("reorder-network") { AddArgument("NetworkID", &mRequest.networkID); AddArgument("NetworkIndex", 0, UINT8_MAX, &mRequest.networkIndex); AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId commandId = chip::app::Clusters::NetworkCommissioning::Commands::ReorderNetwork::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRNetworkCommissioningClusterReorderNetworkParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.networkID = [NSData dataWithBytes:mRequest.networkID.data() length:mRequest.networkID.size()]; params.networkIndex = [NSNumber numberWithUnsignedChar:mRequest.networkIndex]; if (mRequest.breadcrumb.HasValue()) { params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; } else { params.breadcrumb = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster reorderNetworkWithParams:params completion: ^(MTRNetworkCommissioningClusterNetworkConfigResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::NetworkCommissioning::Commands::NetworkConfigResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::NetworkCommissioning::Commands::NetworkConfigResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::NetworkCommissioning::Commands::ReorderNetwork::Type mRequest; }; #if MTR_ENABLE_PROVISIONAL /* * Command QueryIdentity */ class NetworkCommissioningQueryIdentity : public ClusterCommand { public: NetworkCommissioningQueryIdentity() : ClusterCommand("query-identity") { #if MTR_ENABLE_PROVISIONAL AddArgument("KeyIdentifier", &mRequest.keyIdentifier); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("PossessionNonce", &mRequest.possessionNonce); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId commandId = chip::app::Clusters::NetworkCommissioning::Commands::QueryIdentity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRNetworkCommissioningClusterQueryIdentityParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.keyIdentifier = [NSData dataWithBytes:mRequest.keyIdentifier.data() length:mRequest.keyIdentifier.size()]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.possessionNonce.HasValue()) { params.possessionNonce = [NSData dataWithBytes:mRequest.possessionNonce.Value().data() length:mRequest.possessionNonce.Value().size()]; } else { params.possessionNonce = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster queryIdentityWithParams:params completion: ^(MTRNetworkCommissioningClusterQueryIdentityResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::NetworkCommissioning::Commands::QueryIdentityResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::NetworkCommissioning::Commands::QueryIdentityResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::NetworkCommissioning::Commands::QueryIdentity::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute MaxNetworks */ class ReadNetworkCommissioningMaxNetworks : public ReadAttribute { public: ReadNetworkCommissioningMaxNetworks() : ReadAttribute("max-networks") { } ~ReadNetworkCommissioningMaxNetworks() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::MaxNetworks::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxNetworksWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.MaxNetworks response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning MaxNetworks read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNetworkCommissioningMaxNetworks : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningMaxNetworks() : SubscribeAttribute("max-networks") { } ~SubscribeAttributeNetworkCommissioningMaxNetworks() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::MaxNetworks::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxNetworksWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.MaxNetworks response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Networks */ class ReadNetworkCommissioningNetworks : public ReadAttribute { public: ReadNetworkCommissioningNetworks() : ReadAttribute("networks") { } ~ReadNetworkCommissioningNetworks() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::Networks::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNetworksWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.Networks response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning Networks read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNetworkCommissioningNetworks : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningNetworks() : SubscribeAttribute("networks") { } ~SubscribeAttributeNetworkCommissioningNetworks() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::Networks::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNetworksWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.Networks response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ScanMaxTimeSeconds */ class ReadNetworkCommissioningScanMaxTimeSeconds : public ReadAttribute { public: ReadNetworkCommissioningScanMaxTimeSeconds() : ReadAttribute("scan-max-time-seconds") { } ~ReadNetworkCommissioningScanMaxTimeSeconds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::ScanMaxTimeSeconds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeScanMaxTimeSecondsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.ScanMaxTimeSeconds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning ScanMaxTimeSeconds read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNetworkCommissioningScanMaxTimeSeconds : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningScanMaxTimeSeconds() : SubscribeAttribute("scan-max-time-seconds") { } ~SubscribeAttributeNetworkCommissioningScanMaxTimeSeconds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::ScanMaxTimeSeconds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeScanMaxTimeSecondsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.ScanMaxTimeSeconds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ConnectMaxTimeSeconds */ class ReadNetworkCommissioningConnectMaxTimeSeconds : public ReadAttribute { public: ReadNetworkCommissioningConnectMaxTimeSeconds() : ReadAttribute("connect-max-time-seconds") { } ~ReadNetworkCommissioningConnectMaxTimeSeconds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::ConnectMaxTimeSeconds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeConnectMaxTimeSecondsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.ConnectMaxTimeSeconds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning ConnectMaxTimeSeconds read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNetworkCommissioningConnectMaxTimeSeconds : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningConnectMaxTimeSeconds() : SubscribeAttribute("connect-max-time-seconds") { } ~SubscribeAttributeNetworkCommissioningConnectMaxTimeSeconds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::ConnectMaxTimeSeconds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeConnectMaxTimeSecondsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.ConnectMaxTimeSeconds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute InterfaceEnabled */ class ReadNetworkCommissioningInterfaceEnabled : public ReadAttribute { public: ReadNetworkCommissioningInterfaceEnabled() : ReadAttribute("interface-enabled") { } ~ReadNetworkCommissioningInterfaceEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::InterfaceEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInterfaceEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.InterfaceEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning InterfaceEnabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteNetworkCommissioningInterfaceEnabled : public WriteAttribute { public: WriteNetworkCommissioningInterfaceEnabled() : WriteAttribute("interface-enabled") { AddArgument("attr-name", "interface-enabled"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteNetworkCommissioningInterfaceEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::InterfaceEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeInterfaceEnabledWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("NetworkCommissioning InterfaceEnabled write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeNetworkCommissioningInterfaceEnabled : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningInterfaceEnabled() : SubscribeAttribute("interface-enabled") { } ~SubscribeAttributeNetworkCommissioningInterfaceEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::InterfaceEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInterfaceEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.InterfaceEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LastNetworkingStatus */ class ReadNetworkCommissioningLastNetworkingStatus : public ReadAttribute { public: ReadNetworkCommissioningLastNetworkingStatus() : ReadAttribute("last-networking-status") { } ~ReadNetworkCommissioningLastNetworkingStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::LastNetworkingStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLastNetworkingStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.LastNetworkingStatus response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning LastNetworkingStatus read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNetworkCommissioningLastNetworkingStatus : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningLastNetworkingStatus() : SubscribeAttribute("last-networking-status") { } ~SubscribeAttributeNetworkCommissioningLastNetworkingStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::LastNetworkingStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLastNetworkingStatusWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.LastNetworkingStatus response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LastNetworkID */ class ReadNetworkCommissioningLastNetworkID : public ReadAttribute { public: ReadNetworkCommissioningLastNetworkID() : ReadAttribute("last-network-id") { } ~ReadNetworkCommissioningLastNetworkID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::LastNetworkID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLastNetworkIDWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.LastNetworkID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning LastNetworkID read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNetworkCommissioningLastNetworkID : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningLastNetworkID() : SubscribeAttribute("last-network-id") { } ~SubscribeAttributeNetworkCommissioningLastNetworkID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::LastNetworkID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLastNetworkIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.LastNetworkID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LastConnectErrorValue */ class ReadNetworkCommissioningLastConnectErrorValue : public ReadAttribute { public: ReadNetworkCommissioningLastConnectErrorValue() : ReadAttribute("last-connect-error-value") { } ~ReadNetworkCommissioningLastConnectErrorValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::LastConnectErrorValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLastConnectErrorValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.LastConnectErrorValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning LastConnectErrorValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNetworkCommissioningLastConnectErrorValue : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningLastConnectErrorValue() : SubscribeAttribute("last-connect-error-value") { } ~SubscribeAttributeNetworkCommissioningLastConnectErrorValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::LastConnectErrorValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLastConnectErrorValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.LastConnectErrorValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedWiFiBands */ class ReadNetworkCommissioningSupportedWiFiBands : public ReadAttribute { public: ReadNetworkCommissioningSupportedWiFiBands() : ReadAttribute("supported-wi-fi-bands") { } ~ReadNetworkCommissioningSupportedWiFiBands() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::SupportedWiFiBands::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedWiFiBandsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.SupportedWiFiBands response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning SupportedWiFiBands read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNetworkCommissioningSupportedWiFiBands : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningSupportedWiFiBands() : SubscribeAttribute("supported-wi-fi-bands") { } ~SubscribeAttributeNetworkCommissioningSupportedWiFiBands() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::SupportedWiFiBands::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedWiFiBandsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.SupportedWiFiBands response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedThreadFeatures */ class ReadNetworkCommissioningSupportedThreadFeatures : public ReadAttribute { public: ReadNetworkCommissioningSupportedThreadFeatures() : ReadAttribute("supported-thread-features") { } ~ReadNetworkCommissioningSupportedThreadFeatures() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::SupportedThreadFeatures::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedThreadFeaturesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.SupportedThreadFeatures response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning SupportedThreadFeatures read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNetworkCommissioningSupportedThreadFeatures : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningSupportedThreadFeatures() : SubscribeAttribute("supported-thread-features") { } ~SubscribeAttributeNetworkCommissioningSupportedThreadFeatures() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::SupportedThreadFeatures::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedThreadFeaturesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.SupportedThreadFeatures response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ThreadVersion */ class ReadNetworkCommissioningThreadVersion : public ReadAttribute { public: ReadNetworkCommissioningThreadVersion() : ReadAttribute("thread-version") { } ~ReadNetworkCommissioningThreadVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::ThreadVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeThreadVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.ThreadVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning ThreadVersion read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNetworkCommissioningThreadVersion : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningThreadVersion() : SubscribeAttribute("thread-version") { } ~SubscribeAttributeNetworkCommissioningThreadVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::ThreadVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeThreadVersionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.ThreadVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadNetworkCommissioningGeneratedCommandList : public ReadAttribute { public: ReadNetworkCommissioningGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadNetworkCommissioningGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNetworkCommissioningGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeNetworkCommissioningGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadNetworkCommissioningAcceptedCommandList : public ReadAttribute { public: ReadNetworkCommissioningAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadNetworkCommissioningAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNetworkCommissioningAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeNetworkCommissioningAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadNetworkCommissioningEventList : public ReadAttribute { public: ReadNetworkCommissioningEventList() : ReadAttribute("event-list") { } ~ReadNetworkCommissioningEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNetworkCommissioningEventList : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeNetworkCommissioningEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadNetworkCommissioningAttributeList : public ReadAttribute { public: ReadNetworkCommissioningAttributeList() : ReadAttribute("attribute-list") { } ~ReadNetworkCommissioningAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNetworkCommissioningAttributeList : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeNetworkCommissioningAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadNetworkCommissioningFeatureMap : public ReadAttribute { public: ReadNetworkCommissioningFeatureMap() : ReadAttribute("feature-map") { } ~ReadNetworkCommissioningFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNetworkCommissioningFeatureMap : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeNetworkCommissioningFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadNetworkCommissioningClusterRevision : public ReadAttribute { public: ReadNetworkCommissioningClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadNetworkCommissioningClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NetworkCommissioning ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNetworkCommissioningClusterRevision : public SubscribeAttribute { public: SubscribeAttributeNetworkCommissioningClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeNetworkCommissioningClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NetworkCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NetworkCommissioning::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster DiagnosticLogs | 0x0032 | |------------------------------------------------------------------------------| | Commands: | | | * RetrieveLogsRequest | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command RetrieveLogsRequest */ class DiagnosticLogsRetrieveLogsRequest : public ClusterCommand { public: DiagnosticLogsRetrieveLogsRequest() : ClusterCommand("retrieve-logs-request") { AddArgument("Intent", 0, UINT8_MAX, &mRequest.intent); AddArgument("RequestedProtocol", 0, UINT8_MAX, &mRequest.requestedProtocol); AddArgument("TransferFileDesignator", &mRequest.transferFileDesignator); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DiagnosticLogs::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDiagnosticLogsClusterRetrieveLogsRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.intent = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.intent)]; params.requestedProtocol = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.requestedProtocol)]; if (mRequest.transferFileDesignator.HasValue()) { params.transferFileDesignator = [[NSString alloc] initWithBytes:mRequest.transferFileDesignator.Value().data() length:mRequest.transferFileDesignator.Value().size() encoding:NSUTF8StringEncoding]; } else { params.transferFileDesignator = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster retrieveLogsRequestWithParams:params completion: ^(MTRDiagnosticLogsClusterRetrieveLogsResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsRequest::Type mRequest; }; /* * Attribute GeneratedCommandList */ class ReadDiagnosticLogsGeneratedCommandList : public ReadAttribute { public: ReadDiagnosticLogsGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadDiagnosticLogsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DiagnosticLogs::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DiagnosticLogs::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DiagnosticLogs.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DiagnosticLogs GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDiagnosticLogsGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeDiagnosticLogsGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeDiagnosticLogsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DiagnosticLogs::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DiagnosticLogs::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DiagnosticLogs.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadDiagnosticLogsAcceptedCommandList : public ReadAttribute { public: ReadDiagnosticLogsAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadDiagnosticLogsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DiagnosticLogs::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DiagnosticLogs::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DiagnosticLogs.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DiagnosticLogs AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDiagnosticLogsAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeDiagnosticLogsAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeDiagnosticLogsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DiagnosticLogs::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DiagnosticLogs::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DiagnosticLogs.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadDiagnosticLogsEventList : public ReadAttribute { public: ReadDiagnosticLogsEventList() : ReadAttribute("event-list") { } ~ReadDiagnosticLogsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DiagnosticLogs::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DiagnosticLogs::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DiagnosticLogs.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DiagnosticLogs EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDiagnosticLogsEventList : public SubscribeAttribute { public: SubscribeAttributeDiagnosticLogsEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeDiagnosticLogsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DiagnosticLogs::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DiagnosticLogs::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DiagnosticLogs.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadDiagnosticLogsAttributeList : public ReadAttribute { public: ReadDiagnosticLogsAttributeList() : ReadAttribute("attribute-list") { } ~ReadDiagnosticLogsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DiagnosticLogs::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DiagnosticLogs::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DiagnosticLogs.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DiagnosticLogs AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDiagnosticLogsAttributeList : public SubscribeAttribute { public: SubscribeAttributeDiagnosticLogsAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeDiagnosticLogsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DiagnosticLogs::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DiagnosticLogs::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DiagnosticLogs.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadDiagnosticLogsFeatureMap : public ReadAttribute { public: ReadDiagnosticLogsFeatureMap() : ReadAttribute("feature-map") { } ~ReadDiagnosticLogsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DiagnosticLogs::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DiagnosticLogs::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DiagnosticLogs.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DiagnosticLogs FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDiagnosticLogsFeatureMap : public SubscribeAttribute { public: SubscribeAttributeDiagnosticLogsFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeDiagnosticLogsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DiagnosticLogs::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DiagnosticLogs::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DiagnosticLogs.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadDiagnosticLogsClusterRevision : public ReadAttribute { public: ReadDiagnosticLogsClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadDiagnosticLogsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DiagnosticLogs::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DiagnosticLogs::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DiagnosticLogs.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DiagnosticLogs ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDiagnosticLogsClusterRevision : public SubscribeAttribute { public: SubscribeAttributeDiagnosticLogsClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeDiagnosticLogsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DiagnosticLogs::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DiagnosticLogs::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DiagnosticLogs.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster GeneralDiagnostics | 0x0033 | |------------------------------------------------------------------------------| | Commands: | | | * TestEventTrigger | 0x00 | | * TimeSnapshot | 0x01 | | * PayloadTestRequest | 0x03 | |------------------------------------------------------------------------------| | Attributes: | | | * NetworkInterfaces | 0x0000 | | * RebootCount | 0x0001 | | * UpTime | 0x0002 | | * TotalOperationalHours | 0x0003 | | * BootReason | 0x0004 | | * ActiveHardwareFaults | 0x0005 | | * ActiveRadioFaults | 0x0006 | | * ActiveNetworkFaults | 0x0007 | | * TestEventTriggersEnabled | 0x0008 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * HardwareFaultChange | 0x0000 | | * RadioFaultChange | 0x0001 | | * NetworkFaultChange | 0x0002 | | * BootReason | 0x0003 | \*----------------------------------------------------------------------------*/ /* * Command TestEventTrigger */ class GeneralDiagnosticsTestEventTrigger : public ClusterCommand { public: GeneralDiagnosticsTestEventTrigger() : ClusterCommand("test-event-trigger") { AddArgument("EnableKey", &mRequest.enableKey); AddArgument("EventTrigger", 0, UINT64_MAX, &mRequest.eventTrigger); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId commandId = chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGeneralDiagnosticsClusterTestEventTriggerParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.enableKey = [NSData dataWithBytes:mRequest.enableKey.data() length:mRequest.enableKey.size()]; params.eventTrigger = [NSNumber numberWithUnsignedLongLong:mRequest.eventTrigger]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testEventTriggerWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::GeneralDiagnostics::Commands::TestEventTrigger::Type mRequest; }; #if MTR_ENABLE_PROVISIONAL /* * Command TimeSnapshot */ class GeneralDiagnosticsTimeSnapshot : public ClusterCommand { public: GeneralDiagnosticsTimeSnapshot() : ClusterCommand("time-snapshot") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId commandId = chip::app::Clusters::GeneralDiagnostics::Commands::TimeSnapshot::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGeneralDiagnosticsClusterTimeSnapshotParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster timeSnapshotWithParams:params completion: ^(MTRGeneralDiagnosticsClusterTimeSnapshotResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::GeneralDiagnostics::Commands::TimeSnapshotResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::GeneralDiagnostics::Commands::TimeSnapshotResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command PayloadTestRequest */ class GeneralDiagnosticsPayloadTestRequest : public ClusterCommand { public: GeneralDiagnosticsPayloadTestRequest() : ClusterCommand("payload-test-request") { #if MTR_ENABLE_PROVISIONAL AddArgument("EnableKey", &mRequest.enableKey); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Value", 0, UINT8_MAX, &mRequest.value); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Count", 0, UINT16_MAX, &mRequest.count); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId commandId = chip::app::Clusters::GeneralDiagnostics::Commands::PayloadTestRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGeneralDiagnosticsClusterPayloadTestRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.enableKey = [NSData dataWithBytes:mRequest.enableKey.data() length:mRequest.enableKey.size()]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.value = [NSNumber numberWithUnsignedChar:mRequest.value]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.count = [NSNumber numberWithUnsignedShort:mRequest.count]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster payloadTestRequestWithParams:params completion: ^(MTRGeneralDiagnosticsClusterPayloadTestResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::GeneralDiagnostics::Commands::PayloadTestResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::GeneralDiagnostics::Commands::PayloadTestResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::GeneralDiagnostics::Commands::PayloadTestRequest::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute NetworkInterfaces */ class ReadGeneralDiagnosticsNetworkInterfaces : public ReadAttribute { public: ReadGeneralDiagnosticsNetworkInterfaces() : ReadAttribute("network-interfaces") { } ~ReadGeneralDiagnosticsNetworkInterfaces() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::NetworkInterfaces::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNetworkInterfacesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.NetworkInterfaces response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralDiagnostics NetworkInterfaces read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralDiagnosticsNetworkInterfaces : public SubscribeAttribute { public: SubscribeAttributeGeneralDiagnosticsNetworkInterfaces() : SubscribeAttribute("network-interfaces") { } ~SubscribeAttributeGeneralDiagnosticsNetworkInterfaces() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::NetworkInterfaces::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNetworkInterfacesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.NetworkInterfaces response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RebootCount */ class ReadGeneralDiagnosticsRebootCount : public ReadAttribute { public: ReadGeneralDiagnosticsRebootCount() : ReadAttribute("reboot-count") { } ~ReadGeneralDiagnosticsRebootCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::RebootCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRebootCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.RebootCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralDiagnostics RebootCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralDiagnosticsRebootCount : public SubscribeAttribute { public: SubscribeAttributeGeneralDiagnosticsRebootCount() : SubscribeAttribute("reboot-count") { } ~SubscribeAttributeGeneralDiagnosticsRebootCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::RebootCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRebootCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.RebootCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute UpTime */ class ReadGeneralDiagnosticsUpTime : public ReadAttribute { public: ReadGeneralDiagnosticsUpTime() : ReadAttribute("up-time") { } ~ReadGeneralDiagnosticsUpTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::UpTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUpTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.UpTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralDiagnostics UpTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralDiagnosticsUpTime : public SubscribeAttribute { public: SubscribeAttributeGeneralDiagnosticsUpTime() : SubscribeAttribute("up-time") { } ~SubscribeAttributeGeneralDiagnosticsUpTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::UpTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUpTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.UpTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TotalOperationalHours */ class ReadGeneralDiagnosticsTotalOperationalHours : public ReadAttribute { public: ReadGeneralDiagnosticsTotalOperationalHours() : ReadAttribute("total-operational-hours") { } ~ReadGeneralDiagnosticsTotalOperationalHours() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::TotalOperationalHours::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTotalOperationalHoursWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.TotalOperationalHours response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralDiagnostics TotalOperationalHours read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralDiagnosticsTotalOperationalHours : public SubscribeAttribute { public: SubscribeAttributeGeneralDiagnosticsTotalOperationalHours() : SubscribeAttribute("total-operational-hours") { } ~SubscribeAttributeGeneralDiagnosticsTotalOperationalHours() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::TotalOperationalHours::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTotalOperationalHoursWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.TotalOperationalHours response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BootReason */ class ReadGeneralDiagnosticsBootReason : public ReadAttribute { public: ReadGeneralDiagnosticsBootReason() : ReadAttribute("boot-reason") { } ~ReadGeneralDiagnosticsBootReason() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::BootReason::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBootReasonWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.BootReason response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralDiagnostics BootReason read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralDiagnosticsBootReason : public SubscribeAttribute { public: SubscribeAttributeGeneralDiagnosticsBootReason() : SubscribeAttribute("boot-reason") { } ~SubscribeAttributeGeneralDiagnosticsBootReason() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::BootReason::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBootReasonWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.BootReason response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ActiveHardwareFaults */ class ReadGeneralDiagnosticsActiveHardwareFaults : public ReadAttribute { public: ReadGeneralDiagnosticsActiveHardwareFaults() : ReadAttribute("active-hardware-faults") { } ~ReadGeneralDiagnosticsActiveHardwareFaults() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::ActiveHardwareFaults::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveHardwareFaultsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.ActiveHardwareFaults response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralDiagnostics ActiveHardwareFaults read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralDiagnosticsActiveHardwareFaults : public SubscribeAttribute { public: SubscribeAttributeGeneralDiagnosticsActiveHardwareFaults() : SubscribeAttribute("active-hardware-faults") { } ~SubscribeAttributeGeneralDiagnosticsActiveHardwareFaults() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::ActiveHardwareFaults::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveHardwareFaultsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.ActiveHardwareFaults response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ActiveRadioFaults */ class ReadGeneralDiagnosticsActiveRadioFaults : public ReadAttribute { public: ReadGeneralDiagnosticsActiveRadioFaults() : ReadAttribute("active-radio-faults") { } ~ReadGeneralDiagnosticsActiveRadioFaults() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::ActiveRadioFaults::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveRadioFaultsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.ActiveRadioFaults response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralDiagnostics ActiveRadioFaults read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralDiagnosticsActiveRadioFaults : public SubscribeAttribute { public: SubscribeAttributeGeneralDiagnosticsActiveRadioFaults() : SubscribeAttribute("active-radio-faults") { } ~SubscribeAttributeGeneralDiagnosticsActiveRadioFaults() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::ActiveRadioFaults::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveRadioFaultsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.ActiveRadioFaults response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ActiveNetworkFaults */ class ReadGeneralDiagnosticsActiveNetworkFaults : public ReadAttribute { public: ReadGeneralDiagnosticsActiveNetworkFaults() : ReadAttribute("active-network-faults") { } ~ReadGeneralDiagnosticsActiveNetworkFaults() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::ActiveNetworkFaults::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveNetworkFaultsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.ActiveNetworkFaults response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralDiagnostics ActiveNetworkFaults read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralDiagnosticsActiveNetworkFaults : public SubscribeAttribute { public: SubscribeAttributeGeneralDiagnosticsActiveNetworkFaults() : SubscribeAttribute("active-network-faults") { } ~SubscribeAttributeGeneralDiagnosticsActiveNetworkFaults() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::ActiveNetworkFaults::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveNetworkFaultsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.ActiveNetworkFaults response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TestEventTriggersEnabled */ class ReadGeneralDiagnosticsTestEventTriggersEnabled : public ReadAttribute { public: ReadGeneralDiagnosticsTestEventTriggersEnabled() : ReadAttribute("test-event-triggers-enabled") { } ~ReadGeneralDiagnosticsTestEventTriggersEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::TestEventTriggersEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTestEventTriggersEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.TestEventTriggersEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralDiagnostics TestEventTriggersEnabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralDiagnosticsTestEventTriggersEnabled : public SubscribeAttribute { public: SubscribeAttributeGeneralDiagnosticsTestEventTriggersEnabled() : SubscribeAttribute("test-event-triggers-enabled") { } ~SubscribeAttributeGeneralDiagnosticsTestEventTriggersEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::TestEventTriggersEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTestEventTriggersEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.TestEventTriggersEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadGeneralDiagnosticsGeneratedCommandList : public ReadAttribute { public: ReadGeneralDiagnosticsGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadGeneralDiagnosticsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralDiagnostics GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralDiagnosticsGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeGeneralDiagnosticsGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeGeneralDiagnosticsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadGeneralDiagnosticsAcceptedCommandList : public ReadAttribute { public: ReadGeneralDiagnosticsAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadGeneralDiagnosticsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralDiagnostics AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralDiagnosticsAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeGeneralDiagnosticsAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeGeneralDiagnosticsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadGeneralDiagnosticsEventList : public ReadAttribute { public: ReadGeneralDiagnosticsEventList() : ReadAttribute("event-list") { } ~ReadGeneralDiagnosticsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralDiagnostics EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralDiagnosticsEventList : public SubscribeAttribute { public: SubscribeAttributeGeneralDiagnosticsEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeGeneralDiagnosticsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadGeneralDiagnosticsAttributeList : public ReadAttribute { public: ReadGeneralDiagnosticsAttributeList() : ReadAttribute("attribute-list") { } ~ReadGeneralDiagnosticsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralDiagnostics AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralDiagnosticsAttributeList : public SubscribeAttribute { public: SubscribeAttributeGeneralDiagnosticsAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeGeneralDiagnosticsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadGeneralDiagnosticsFeatureMap : public ReadAttribute { public: ReadGeneralDiagnosticsFeatureMap() : ReadAttribute("feature-map") { } ~ReadGeneralDiagnosticsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralDiagnostics FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralDiagnosticsFeatureMap : public SubscribeAttribute { public: SubscribeAttributeGeneralDiagnosticsFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeGeneralDiagnosticsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadGeneralDiagnosticsClusterRevision : public ReadAttribute { public: ReadGeneralDiagnosticsClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadGeneralDiagnosticsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GeneralDiagnostics ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGeneralDiagnosticsClusterRevision : public SubscribeAttribute { public: SubscribeAttributeGeneralDiagnosticsClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeGeneralDiagnosticsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GeneralDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GeneralDiagnostics::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster SoftwareDiagnostics | 0x0034 | |------------------------------------------------------------------------------| | Commands: | | | * ResetWatermarks | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * ThreadMetrics | 0x0000 | | * CurrentHeapFree | 0x0001 | | * CurrentHeapUsed | 0x0002 | | * CurrentHeapHighWatermark | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * SoftwareFault | 0x0000 | \*----------------------------------------------------------------------------*/ /* * Command ResetWatermarks */ class SoftwareDiagnosticsResetWatermarks : public ClusterCommand { public: SoftwareDiagnosticsResetWatermarks() : ClusterCommand("reset-watermarks") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::CommandId commandId = chip::app::Clusters::SoftwareDiagnostics::Commands::ResetWatermarks::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSoftwareDiagnosticsClusterResetWatermarksParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster resetWatermarksWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Attribute ThreadMetrics */ class ReadSoftwareDiagnosticsThreadMetrics : public ReadAttribute { public: ReadSoftwareDiagnosticsThreadMetrics() : ReadAttribute("thread-metrics") { } ~ReadSoftwareDiagnosticsThreadMetrics() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::ThreadMetrics::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeThreadMetricsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.ThreadMetrics response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SoftwareDiagnostics ThreadMetrics read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSoftwareDiagnosticsThreadMetrics : public SubscribeAttribute { public: SubscribeAttributeSoftwareDiagnosticsThreadMetrics() : SubscribeAttribute("thread-metrics") { } ~SubscribeAttributeSoftwareDiagnosticsThreadMetrics() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::ThreadMetrics::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeThreadMetricsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.ThreadMetrics response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentHeapFree */ class ReadSoftwareDiagnosticsCurrentHeapFree : public ReadAttribute { public: ReadSoftwareDiagnosticsCurrentHeapFree() : ReadAttribute("current-heap-free") { } ~ReadSoftwareDiagnosticsCurrentHeapFree() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::CurrentHeapFree::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentHeapFreeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.CurrentHeapFree response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SoftwareDiagnostics CurrentHeapFree read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSoftwareDiagnosticsCurrentHeapFree : public SubscribeAttribute { public: SubscribeAttributeSoftwareDiagnosticsCurrentHeapFree() : SubscribeAttribute("current-heap-free") { } ~SubscribeAttributeSoftwareDiagnosticsCurrentHeapFree() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::CurrentHeapFree::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentHeapFreeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.CurrentHeapFree response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentHeapUsed */ class ReadSoftwareDiagnosticsCurrentHeapUsed : public ReadAttribute { public: ReadSoftwareDiagnosticsCurrentHeapUsed() : ReadAttribute("current-heap-used") { } ~ReadSoftwareDiagnosticsCurrentHeapUsed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::CurrentHeapUsed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentHeapUsedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.CurrentHeapUsed response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SoftwareDiagnostics CurrentHeapUsed read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSoftwareDiagnosticsCurrentHeapUsed : public SubscribeAttribute { public: SubscribeAttributeSoftwareDiagnosticsCurrentHeapUsed() : SubscribeAttribute("current-heap-used") { } ~SubscribeAttributeSoftwareDiagnosticsCurrentHeapUsed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::CurrentHeapUsed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentHeapUsedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.CurrentHeapUsed response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentHeapHighWatermark */ class ReadSoftwareDiagnosticsCurrentHeapHighWatermark : public ReadAttribute { public: ReadSoftwareDiagnosticsCurrentHeapHighWatermark() : ReadAttribute("current-heap-high-watermark") { } ~ReadSoftwareDiagnosticsCurrentHeapHighWatermark() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::CurrentHeapHighWatermark::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentHeapHighWatermarkWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.CurrentHeapHighWatermark response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SoftwareDiagnostics CurrentHeapHighWatermark read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSoftwareDiagnosticsCurrentHeapHighWatermark : public SubscribeAttribute { public: SubscribeAttributeSoftwareDiagnosticsCurrentHeapHighWatermark() : SubscribeAttribute("current-heap-high-watermark") { } ~SubscribeAttributeSoftwareDiagnosticsCurrentHeapHighWatermark() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::CurrentHeapHighWatermark::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentHeapHighWatermarkWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.CurrentHeapHighWatermark response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadSoftwareDiagnosticsGeneratedCommandList : public ReadAttribute { public: ReadSoftwareDiagnosticsGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadSoftwareDiagnosticsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SoftwareDiagnostics GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSoftwareDiagnosticsGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeSoftwareDiagnosticsGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeSoftwareDiagnosticsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadSoftwareDiagnosticsAcceptedCommandList : public ReadAttribute { public: ReadSoftwareDiagnosticsAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadSoftwareDiagnosticsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SoftwareDiagnostics AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSoftwareDiagnosticsAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeSoftwareDiagnosticsAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeSoftwareDiagnosticsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadSoftwareDiagnosticsEventList : public ReadAttribute { public: ReadSoftwareDiagnosticsEventList() : ReadAttribute("event-list") { } ~ReadSoftwareDiagnosticsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SoftwareDiagnostics EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSoftwareDiagnosticsEventList : public SubscribeAttribute { public: SubscribeAttributeSoftwareDiagnosticsEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeSoftwareDiagnosticsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadSoftwareDiagnosticsAttributeList : public ReadAttribute { public: ReadSoftwareDiagnosticsAttributeList() : ReadAttribute("attribute-list") { } ~ReadSoftwareDiagnosticsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SoftwareDiagnostics AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSoftwareDiagnosticsAttributeList : public SubscribeAttribute { public: SubscribeAttributeSoftwareDiagnosticsAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeSoftwareDiagnosticsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadSoftwareDiagnosticsFeatureMap : public ReadAttribute { public: ReadSoftwareDiagnosticsFeatureMap() : ReadAttribute("feature-map") { } ~ReadSoftwareDiagnosticsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SoftwareDiagnostics FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSoftwareDiagnosticsFeatureMap : public SubscribeAttribute { public: SubscribeAttributeSoftwareDiagnosticsFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeSoftwareDiagnosticsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadSoftwareDiagnosticsClusterRevision : public ReadAttribute { public: ReadSoftwareDiagnosticsClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadSoftwareDiagnosticsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SoftwareDiagnostics ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSoftwareDiagnosticsClusterRevision : public SubscribeAttribute { public: SubscribeAttributeSoftwareDiagnosticsClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeSoftwareDiagnosticsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SoftwareDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SoftwareDiagnostics::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster ThreadNetworkDiagnostics | 0x0035 | |------------------------------------------------------------------------------| | Commands: | | | * ResetCounts | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * Channel | 0x0000 | | * RoutingRole | 0x0001 | | * NetworkName | 0x0002 | | * PanId | 0x0003 | | * ExtendedPanId | 0x0004 | | * MeshLocalPrefix | 0x0005 | | * OverrunCount | 0x0006 | | * NeighborTable | 0x0007 | | * RouteTable | 0x0008 | | * PartitionId | 0x0009 | | * Weighting | 0x000A | | * DataVersion | 0x000B | | * StableDataVersion | 0x000C | | * LeaderRouterId | 0x000D | | * DetachedRoleCount | 0x000E | | * ChildRoleCount | 0x000F | | * RouterRoleCount | 0x0010 | | * LeaderRoleCount | 0x0011 | | * AttachAttemptCount | 0x0012 | | * PartitionIdChangeCount | 0x0013 | | * BetterPartitionAttachAttemptCount | 0x0014 | | * ParentChangeCount | 0x0015 | | * TxTotalCount | 0x0016 | | * TxUnicastCount | 0x0017 | | * TxBroadcastCount | 0x0018 | | * TxAckRequestedCount | 0x0019 | | * TxAckedCount | 0x001A | | * TxNoAckRequestedCount | 0x001B | | * TxDataCount | 0x001C | | * TxDataPollCount | 0x001D | | * TxBeaconCount | 0x001E | | * TxBeaconRequestCount | 0x001F | | * TxOtherCount | 0x0020 | | * TxRetryCount | 0x0021 | | * TxDirectMaxRetryExpiryCount | 0x0022 | | * TxIndirectMaxRetryExpiryCount | 0x0023 | | * TxErrCcaCount | 0x0024 | | * TxErrAbortCount | 0x0025 | | * TxErrBusyChannelCount | 0x0026 | | * RxTotalCount | 0x0027 | | * RxUnicastCount | 0x0028 | | * RxBroadcastCount | 0x0029 | | * RxDataCount | 0x002A | | * RxDataPollCount | 0x002B | | * RxBeaconCount | 0x002C | | * RxBeaconRequestCount | 0x002D | | * RxOtherCount | 0x002E | | * RxAddressFilteredCount | 0x002F | | * RxDestAddrFilteredCount | 0x0030 | | * RxDuplicatedCount | 0x0031 | | * RxErrNoFrameCount | 0x0032 | | * RxErrUnknownNeighborCount | 0x0033 | | * RxErrInvalidSrcAddrCount | 0x0034 | | * RxErrSecCount | 0x0035 | | * RxErrFcsCount | 0x0036 | | * RxErrOtherCount | 0x0037 | | * ActiveTimestamp | 0x0038 | | * PendingTimestamp | 0x0039 | | * Delay | 0x003A | | * SecurityPolicy | 0x003B | | * ChannelPage0Mask | 0x003C | | * OperationalDatasetComponents | 0x003D | | * ActiveNetworkFaultsList | 0x003E | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * ConnectionStatus | 0x0000 | | * NetworkFaultChange | 0x0001 | \*----------------------------------------------------------------------------*/ /* * Command ResetCounts */ class ThreadNetworkDiagnosticsResetCounts : public ClusterCommand { public: ThreadNetworkDiagnosticsResetCounts() : ClusterCommand("reset-counts") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ThreadNetworkDiagnostics::Commands::ResetCounts::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRThreadNetworkDiagnosticsClusterResetCountsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster resetCountsWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Attribute Channel */ class ReadThreadNetworkDiagnosticsChannel : public ReadAttribute { public: ReadThreadNetworkDiagnosticsChannel() : ReadAttribute("channel") { } ~ReadThreadNetworkDiagnosticsChannel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Channel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeChannelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.Channel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics Channel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsChannel : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsChannel() : SubscribeAttribute("channel") { } ~SubscribeAttributeThreadNetworkDiagnosticsChannel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Channel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeChannelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.Channel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RoutingRole */ class ReadThreadNetworkDiagnosticsRoutingRole : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRoutingRole() : ReadAttribute("routing-role") { } ~ReadThreadNetworkDiagnosticsRoutingRole() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RoutingRole::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRoutingRoleWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RoutingRole response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RoutingRole read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRoutingRole : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRoutingRole() : SubscribeAttribute("routing-role") { } ~SubscribeAttributeThreadNetworkDiagnosticsRoutingRole() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RoutingRole::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRoutingRoleWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RoutingRole response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NetworkName */ class ReadThreadNetworkDiagnosticsNetworkName : public ReadAttribute { public: ReadThreadNetworkDiagnosticsNetworkName() : ReadAttribute("network-name") { } ~ReadThreadNetworkDiagnosticsNetworkName() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::NetworkName::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNetworkNameWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.NetworkName response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics NetworkName read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsNetworkName : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsNetworkName() : SubscribeAttribute("network-name") { } ~SubscribeAttributeThreadNetworkDiagnosticsNetworkName() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::NetworkName::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNetworkNameWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.NetworkName response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PanId */ class ReadThreadNetworkDiagnosticsPanId : public ReadAttribute { public: ReadThreadNetworkDiagnosticsPanId() : ReadAttribute("pan-id") { } ~ReadThreadNetworkDiagnosticsPanId() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PanId::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePanIdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.PanId response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics PanId read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsPanId : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsPanId() : SubscribeAttribute("pan-id") { } ~SubscribeAttributeThreadNetworkDiagnosticsPanId() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PanId::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePanIdWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.PanId response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ExtendedPanId */ class ReadThreadNetworkDiagnosticsExtendedPanId : public ReadAttribute { public: ReadThreadNetworkDiagnosticsExtendedPanId() : ReadAttribute("extended-pan-id") { } ~ReadThreadNetworkDiagnosticsExtendedPanId() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ExtendedPanId::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeExtendedPanIdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ExtendedPanId response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics ExtendedPanId read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsExtendedPanId : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsExtendedPanId() : SubscribeAttribute("extended-pan-id") { } ~SubscribeAttributeThreadNetworkDiagnosticsExtendedPanId() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ExtendedPanId::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeExtendedPanIdWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ExtendedPanId response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeshLocalPrefix */ class ReadThreadNetworkDiagnosticsMeshLocalPrefix : public ReadAttribute { public: ReadThreadNetworkDiagnosticsMeshLocalPrefix() : ReadAttribute("mesh-local-prefix") { } ~ReadThreadNetworkDiagnosticsMeshLocalPrefix() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::MeshLocalPrefix::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeshLocalPrefixWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.MeshLocalPrefix response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics MeshLocalPrefix read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsMeshLocalPrefix : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsMeshLocalPrefix() : SubscribeAttribute("mesh-local-prefix") { } ~SubscribeAttributeThreadNetworkDiagnosticsMeshLocalPrefix() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::MeshLocalPrefix::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeshLocalPrefixWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.MeshLocalPrefix response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OverrunCount */ class ReadThreadNetworkDiagnosticsOverrunCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsOverrunCount() : ReadAttribute("overrun-count") { } ~ReadThreadNetworkDiagnosticsOverrunCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::OverrunCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOverrunCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.OverrunCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics OverrunCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsOverrunCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsOverrunCount() : SubscribeAttribute("overrun-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsOverrunCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::OverrunCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOverrunCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.OverrunCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NeighborTable */ class ReadThreadNetworkDiagnosticsNeighborTable : public ReadAttribute { public: ReadThreadNetworkDiagnosticsNeighborTable() : ReadAttribute("neighbor-table") { } ~ReadThreadNetworkDiagnosticsNeighborTable() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::NeighborTable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNeighborTableWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.NeighborTable response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics NeighborTable read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsNeighborTable : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsNeighborTable() : SubscribeAttribute("neighbor-table") { } ~SubscribeAttributeThreadNetworkDiagnosticsNeighborTable() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::NeighborTable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNeighborTableWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.NeighborTable response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RouteTable */ class ReadThreadNetworkDiagnosticsRouteTable : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRouteTable() : ReadAttribute("route-table") { } ~ReadThreadNetworkDiagnosticsRouteTable() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RouteTable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRouteTableWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RouteTable response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RouteTable read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRouteTable : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRouteTable() : SubscribeAttribute("route-table") { } ~SubscribeAttributeThreadNetworkDiagnosticsRouteTable() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RouteTable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRouteTableWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RouteTable response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PartitionId */ class ReadThreadNetworkDiagnosticsPartitionId : public ReadAttribute { public: ReadThreadNetworkDiagnosticsPartitionId() : ReadAttribute("partition-id") { } ~ReadThreadNetworkDiagnosticsPartitionId() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PartitionId::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePartitionIdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.PartitionId response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics PartitionId read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsPartitionId : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsPartitionId() : SubscribeAttribute("partition-id") { } ~SubscribeAttributeThreadNetworkDiagnosticsPartitionId() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PartitionId::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePartitionIdWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.PartitionId response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Weighting */ class ReadThreadNetworkDiagnosticsWeighting : public ReadAttribute { public: ReadThreadNetworkDiagnosticsWeighting() : ReadAttribute("weighting") { } ~ReadThreadNetworkDiagnosticsWeighting() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Weighting::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWeightingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.Weighting response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics Weighting read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsWeighting : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsWeighting() : SubscribeAttribute("weighting") { } ~SubscribeAttributeThreadNetworkDiagnosticsWeighting() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Weighting::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWeightingWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.Weighting response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute DataVersion */ class ReadThreadNetworkDiagnosticsDataVersion : public ReadAttribute { public: ReadThreadNetworkDiagnosticsDataVersion() : ReadAttribute("data-version") { } ~ReadThreadNetworkDiagnosticsDataVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::DataVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDataVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.DataVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics DataVersion read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsDataVersion : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsDataVersion() : SubscribeAttribute("data-version") { } ~SubscribeAttributeThreadNetworkDiagnosticsDataVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::DataVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDataVersionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.DataVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute StableDataVersion */ class ReadThreadNetworkDiagnosticsStableDataVersion : public ReadAttribute { public: ReadThreadNetworkDiagnosticsStableDataVersion() : ReadAttribute("stable-data-version") { } ~ReadThreadNetworkDiagnosticsStableDataVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::StableDataVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStableDataVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.StableDataVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics StableDataVersion read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsStableDataVersion : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsStableDataVersion() : SubscribeAttribute("stable-data-version") { } ~SubscribeAttributeThreadNetworkDiagnosticsStableDataVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::StableDataVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStableDataVersionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.StableDataVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LeaderRouterId */ class ReadThreadNetworkDiagnosticsLeaderRouterId : public ReadAttribute { public: ReadThreadNetworkDiagnosticsLeaderRouterId() : ReadAttribute("leader-router-id") { } ~ReadThreadNetworkDiagnosticsLeaderRouterId() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::LeaderRouterId::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLeaderRouterIdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.LeaderRouterId response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics LeaderRouterId read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsLeaderRouterId : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsLeaderRouterId() : SubscribeAttribute("leader-router-id") { } ~SubscribeAttributeThreadNetworkDiagnosticsLeaderRouterId() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::LeaderRouterId::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLeaderRouterIdWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.LeaderRouterId response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute DetachedRoleCount */ class ReadThreadNetworkDiagnosticsDetachedRoleCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsDetachedRoleCount() : ReadAttribute("detached-role-count") { } ~ReadThreadNetworkDiagnosticsDetachedRoleCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::DetachedRoleCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDetachedRoleCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.DetachedRoleCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics DetachedRoleCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsDetachedRoleCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsDetachedRoleCount() : SubscribeAttribute("detached-role-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsDetachedRoleCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::DetachedRoleCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDetachedRoleCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.DetachedRoleCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ChildRoleCount */ class ReadThreadNetworkDiagnosticsChildRoleCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsChildRoleCount() : ReadAttribute("child-role-count") { } ~ReadThreadNetworkDiagnosticsChildRoleCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ChildRoleCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeChildRoleCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ChildRoleCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics ChildRoleCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsChildRoleCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsChildRoleCount() : SubscribeAttribute("child-role-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsChildRoleCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ChildRoleCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeChildRoleCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ChildRoleCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RouterRoleCount */ class ReadThreadNetworkDiagnosticsRouterRoleCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRouterRoleCount() : ReadAttribute("router-role-count") { } ~ReadThreadNetworkDiagnosticsRouterRoleCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RouterRoleCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRouterRoleCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RouterRoleCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RouterRoleCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRouterRoleCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRouterRoleCount() : SubscribeAttribute("router-role-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRouterRoleCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RouterRoleCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRouterRoleCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RouterRoleCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LeaderRoleCount */ class ReadThreadNetworkDiagnosticsLeaderRoleCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsLeaderRoleCount() : ReadAttribute("leader-role-count") { } ~ReadThreadNetworkDiagnosticsLeaderRoleCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::LeaderRoleCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLeaderRoleCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.LeaderRoleCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics LeaderRoleCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsLeaderRoleCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsLeaderRoleCount() : SubscribeAttribute("leader-role-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsLeaderRoleCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::LeaderRoleCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLeaderRoleCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.LeaderRoleCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AttachAttemptCount */ class ReadThreadNetworkDiagnosticsAttachAttemptCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsAttachAttemptCount() : ReadAttribute("attach-attempt-count") { } ~ReadThreadNetworkDiagnosticsAttachAttemptCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::AttachAttemptCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttachAttemptCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.AttachAttemptCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics AttachAttemptCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsAttachAttemptCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsAttachAttemptCount() : SubscribeAttribute("attach-attempt-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsAttachAttemptCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::AttachAttemptCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttachAttemptCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.AttachAttemptCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PartitionIdChangeCount */ class ReadThreadNetworkDiagnosticsPartitionIdChangeCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsPartitionIdChangeCount() : ReadAttribute("partition-id-change-count") { } ~ReadThreadNetworkDiagnosticsPartitionIdChangeCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PartitionIdChangeCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePartitionIdChangeCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.PartitionIdChangeCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics PartitionIdChangeCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsPartitionIdChangeCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsPartitionIdChangeCount() : SubscribeAttribute("partition-id-change-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsPartitionIdChangeCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PartitionIdChangeCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePartitionIdChangeCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.PartitionIdChangeCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BetterPartitionAttachAttemptCount */ class ReadThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount() : ReadAttribute("better-partition-attach-attempt-count") { } ~ReadThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::BetterPartitionAttachAttemptCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBetterPartitionAttachAttemptCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.BetterPartitionAttachAttemptCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics BetterPartitionAttachAttemptCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount() : SubscribeAttribute("better-partition-attach-attempt-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsBetterPartitionAttachAttemptCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::BetterPartitionAttachAttemptCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBetterPartitionAttachAttemptCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.BetterPartitionAttachAttemptCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ParentChangeCount */ class ReadThreadNetworkDiagnosticsParentChangeCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsParentChangeCount() : ReadAttribute("parent-change-count") { } ~ReadThreadNetworkDiagnosticsParentChangeCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ParentChangeCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeParentChangeCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ParentChangeCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics ParentChangeCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsParentChangeCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsParentChangeCount() : SubscribeAttribute("parent-change-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsParentChangeCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ParentChangeCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeParentChangeCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ParentChangeCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxTotalCount */ class ReadThreadNetworkDiagnosticsTxTotalCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxTotalCount() : ReadAttribute("tx-total-count") { } ~ReadThreadNetworkDiagnosticsTxTotalCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxTotalCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxTotalCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxTotalCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxTotalCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxTotalCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxTotalCount() : SubscribeAttribute("tx-total-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxTotalCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxTotalCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxTotalCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxTotalCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxUnicastCount */ class ReadThreadNetworkDiagnosticsTxUnicastCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxUnicastCount() : ReadAttribute("tx-unicast-count") { } ~ReadThreadNetworkDiagnosticsTxUnicastCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxUnicastCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxUnicastCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxUnicastCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxUnicastCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxUnicastCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxUnicastCount() : SubscribeAttribute("tx-unicast-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxUnicastCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxUnicastCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxUnicastCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxUnicastCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxBroadcastCount */ class ReadThreadNetworkDiagnosticsTxBroadcastCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxBroadcastCount() : ReadAttribute("tx-broadcast-count") { } ~ReadThreadNetworkDiagnosticsTxBroadcastCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBroadcastCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxBroadcastCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxBroadcastCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxBroadcastCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxBroadcastCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxBroadcastCount() : SubscribeAttribute("tx-broadcast-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxBroadcastCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBroadcastCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxBroadcastCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxBroadcastCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxAckRequestedCount */ class ReadThreadNetworkDiagnosticsTxAckRequestedCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxAckRequestedCount() : ReadAttribute("tx-ack-requested-count") { } ~ReadThreadNetworkDiagnosticsTxAckRequestedCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxAckRequestedCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxAckRequestedCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxAckRequestedCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxAckRequestedCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxAckRequestedCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxAckRequestedCount() : SubscribeAttribute("tx-ack-requested-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxAckRequestedCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxAckRequestedCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxAckRequestedCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxAckRequestedCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxAckedCount */ class ReadThreadNetworkDiagnosticsTxAckedCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxAckedCount() : ReadAttribute("tx-acked-count") { } ~ReadThreadNetworkDiagnosticsTxAckedCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxAckedCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxAckedCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxAckedCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxAckedCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxAckedCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxAckedCount() : SubscribeAttribute("tx-acked-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxAckedCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxAckedCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxAckedCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxAckedCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxNoAckRequestedCount */ class ReadThreadNetworkDiagnosticsTxNoAckRequestedCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxNoAckRequestedCount() : ReadAttribute("tx-no-ack-requested-count") { } ~ReadThreadNetworkDiagnosticsTxNoAckRequestedCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxNoAckRequestedCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxNoAckRequestedCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxNoAckRequestedCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxNoAckRequestedCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxNoAckRequestedCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxNoAckRequestedCount() : SubscribeAttribute("tx-no-ack-requested-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxNoAckRequestedCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxNoAckRequestedCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxNoAckRequestedCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxNoAckRequestedCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxDataCount */ class ReadThreadNetworkDiagnosticsTxDataCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxDataCount() : ReadAttribute("tx-data-count") { } ~ReadThreadNetworkDiagnosticsTxDataCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDataCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxDataCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxDataCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxDataCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxDataCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxDataCount() : SubscribeAttribute("tx-data-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxDataCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDataCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxDataCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxDataCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxDataPollCount */ class ReadThreadNetworkDiagnosticsTxDataPollCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxDataPollCount() : ReadAttribute("tx-data-poll-count") { } ~ReadThreadNetworkDiagnosticsTxDataPollCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDataPollCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxDataPollCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxDataPollCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxDataPollCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxDataPollCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxDataPollCount() : SubscribeAttribute("tx-data-poll-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxDataPollCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDataPollCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxDataPollCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxDataPollCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxBeaconCount */ class ReadThreadNetworkDiagnosticsTxBeaconCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxBeaconCount() : ReadAttribute("tx-beacon-count") { } ~ReadThreadNetworkDiagnosticsTxBeaconCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBeaconCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxBeaconCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxBeaconCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxBeaconCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxBeaconCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxBeaconCount() : SubscribeAttribute("tx-beacon-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxBeaconCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBeaconCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxBeaconCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxBeaconCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxBeaconRequestCount */ class ReadThreadNetworkDiagnosticsTxBeaconRequestCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxBeaconRequestCount() : ReadAttribute("tx-beacon-request-count") { } ~ReadThreadNetworkDiagnosticsTxBeaconRequestCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBeaconRequestCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxBeaconRequestCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxBeaconRequestCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxBeaconRequestCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxBeaconRequestCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxBeaconRequestCount() : SubscribeAttribute("tx-beacon-request-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxBeaconRequestCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxBeaconRequestCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxBeaconRequestCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxBeaconRequestCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxOtherCount */ class ReadThreadNetworkDiagnosticsTxOtherCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxOtherCount() : ReadAttribute("tx-other-count") { } ~ReadThreadNetworkDiagnosticsTxOtherCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxOtherCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxOtherCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxOtherCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxOtherCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxOtherCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxOtherCount() : SubscribeAttribute("tx-other-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxOtherCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxOtherCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxOtherCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxOtherCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxRetryCount */ class ReadThreadNetworkDiagnosticsTxRetryCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxRetryCount() : ReadAttribute("tx-retry-count") { } ~ReadThreadNetworkDiagnosticsTxRetryCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxRetryCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxRetryCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxRetryCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxRetryCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxRetryCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxRetryCount() : SubscribeAttribute("tx-retry-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxRetryCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxRetryCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxRetryCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxRetryCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxDirectMaxRetryExpiryCount */ class ReadThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount() : ReadAttribute("tx-direct-max-retry-expiry-count") { } ~ReadThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDirectMaxRetryExpiryCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxDirectMaxRetryExpiryCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxDirectMaxRetryExpiryCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxDirectMaxRetryExpiryCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount() : SubscribeAttribute("tx-direct-max-retry-expiry-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxDirectMaxRetryExpiryCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxDirectMaxRetryExpiryCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxDirectMaxRetryExpiryCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxIndirectMaxRetryExpiryCount */ class ReadThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount() : ReadAttribute("tx-indirect-max-retry-expiry-count") { } ~ReadThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxIndirectMaxRetryExpiryCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxIndirectMaxRetryExpiryCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxIndirectMaxRetryExpiryCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxIndirectMaxRetryExpiryCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount() : SubscribeAttribute("tx-indirect-max-retry-expiry-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxIndirectMaxRetryExpiryCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxIndirectMaxRetryExpiryCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxIndirectMaxRetryExpiryCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxErrCcaCount */ class ReadThreadNetworkDiagnosticsTxErrCcaCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxErrCcaCount() : ReadAttribute("tx-err-cca-count") { } ~ReadThreadNetworkDiagnosticsTxErrCcaCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrCcaCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxErrCcaCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxErrCcaCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxErrCcaCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxErrCcaCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxErrCcaCount() : SubscribeAttribute("tx-err-cca-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxErrCcaCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrCcaCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxErrCcaCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxErrCcaCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxErrAbortCount */ class ReadThreadNetworkDiagnosticsTxErrAbortCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxErrAbortCount() : ReadAttribute("tx-err-abort-count") { } ~ReadThreadNetworkDiagnosticsTxErrAbortCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrAbortCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxErrAbortCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxErrAbortCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxErrAbortCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxErrAbortCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxErrAbortCount() : SubscribeAttribute("tx-err-abort-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxErrAbortCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrAbortCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxErrAbortCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxErrAbortCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxErrBusyChannelCount */ class ReadThreadNetworkDiagnosticsTxErrBusyChannelCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsTxErrBusyChannelCount() : ReadAttribute("tx-err-busy-channel-count") { } ~ReadThreadNetworkDiagnosticsTxErrBusyChannelCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrBusyChannelCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxErrBusyChannelCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxErrBusyChannelCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics TxErrBusyChannelCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsTxErrBusyChannelCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsTxErrBusyChannelCount() : SubscribeAttribute("tx-err-busy-channel-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsTxErrBusyChannelCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::TxErrBusyChannelCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxErrBusyChannelCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxErrBusyChannelCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxTotalCount */ class ReadThreadNetworkDiagnosticsRxTotalCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxTotalCount() : ReadAttribute("rx-total-count") { } ~ReadThreadNetworkDiagnosticsRxTotalCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxTotalCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxTotalCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxTotalCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxTotalCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxTotalCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxTotalCount() : SubscribeAttribute("rx-total-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxTotalCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxTotalCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxTotalCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxTotalCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxUnicastCount */ class ReadThreadNetworkDiagnosticsRxUnicastCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxUnicastCount() : ReadAttribute("rx-unicast-count") { } ~ReadThreadNetworkDiagnosticsRxUnicastCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxUnicastCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxUnicastCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxUnicastCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxUnicastCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxUnicastCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxUnicastCount() : SubscribeAttribute("rx-unicast-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxUnicastCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxUnicastCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxUnicastCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxUnicastCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxBroadcastCount */ class ReadThreadNetworkDiagnosticsRxBroadcastCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxBroadcastCount() : ReadAttribute("rx-broadcast-count") { } ~ReadThreadNetworkDiagnosticsRxBroadcastCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBroadcastCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxBroadcastCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxBroadcastCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxBroadcastCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxBroadcastCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxBroadcastCount() : SubscribeAttribute("rx-broadcast-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxBroadcastCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBroadcastCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxBroadcastCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxBroadcastCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxDataCount */ class ReadThreadNetworkDiagnosticsRxDataCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxDataCount() : ReadAttribute("rx-data-count") { } ~ReadThreadNetworkDiagnosticsRxDataCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDataCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxDataCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxDataCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxDataCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxDataCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxDataCount() : SubscribeAttribute("rx-data-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxDataCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDataCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxDataCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxDataCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxDataPollCount */ class ReadThreadNetworkDiagnosticsRxDataPollCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxDataPollCount() : ReadAttribute("rx-data-poll-count") { } ~ReadThreadNetworkDiagnosticsRxDataPollCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDataPollCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxDataPollCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxDataPollCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxDataPollCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxDataPollCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxDataPollCount() : SubscribeAttribute("rx-data-poll-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxDataPollCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDataPollCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxDataPollCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxDataPollCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxBeaconCount */ class ReadThreadNetworkDiagnosticsRxBeaconCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxBeaconCount() : ReadAttribute("rx-beacon-count") { } ~ReadThreadNetworkDiagnosticsRxBeaconCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBeaconCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxBeaconCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxBeaconCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxBeaconCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxBeaconCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxBeaconCount() : SubscribeAttribute("rx-beacon-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxBeaconCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBeaconCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxBeaconCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxBeaconCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxBeaconRequestCount */ class ReadThreadNetworkDiagnosticsRxBeaconRequestCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxBeaconRequestCount() : ReadAttribute("rx-beacon-request-count") { } ~ReadThreadNetworkDiagnosticsRxBeaconRequestCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBeaconRequestCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxBeaconRequestCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxBeaconRequestCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxBeaconRequestCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxBeaconRequestCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxBeaconRequestCount() : SubscribeAttribute("rx-beacon-request-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxBeaconRequestCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxBeaconRequestCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxBeaconRequestCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxBeaconRequestCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxOtherCount */ class ReadThreadNetworkDiagnosticsRxOtherCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxOtherCount() : ReadAttribute("rx-other-count") { } ~ReadThreadNetworkDiagnosticsRxOtherCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxOtherCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxOtherCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxOtherCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxOtherCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxOtherCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxOtherCount() : SubscribeAttribute("rx-other-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxOtherCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxOtherCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxOtherCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxOtherCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxAddressFilteredCount */ class ReadThreadNetworkDiagnosticsRxAddressFilteredCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxAddressFilteredCount() : ReadAttribute("rx-address-filtered-count") { } ~ReadThreadNetworkDiagnosticsRxAddressFilteredCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxAddressFilteredCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxAddressFilteredCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxAddressFilteredCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxAddressFilteredCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxAddressFilteredCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxAddressFilteredCount() : SubscribeAttribute("rx-address-filtered-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxAddressFilteredCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxAddressFilteredCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxAddressFilteredCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxAddressFilteredCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxDestAddrFilteredCount */ class ReadThreadNetworkDiagnosticsRxDestAddrFilteredCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxDestAddrFilteredCount() : ReadAttribute("rx-dest-addr-filtered-count") { } ~ReadThreadNetworkDiagnosticsRxDestAddrFilteredCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDestAddrFilteredCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxDestAddrFilteredCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxDestAddrFilteredCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxDestAddrFilteredCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxDestAddrFilteredCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxDestAddrFilteredCount() : SubscribeAttribute("rx-dest-addr-filtered-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxDestAddrFilteredCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDestAddrFilteredCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxDestAddrFilteredCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxDestAddrFilteredCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxDuplicatedCount */ class ReadThreadNetworkDiagnosticsRxDuplicatedCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxDuplicatedCount() : ReadAttribute("rx-duplicated-count") { } ~ReadThreadNetworkDiagnosticsRxDuplicatedCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDuplicatedCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxDuplicatedCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxDuplicatedCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxDuplicatedCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxDuplicatedCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxDuplicatedCount() : SubscribeAttribute("rx-duplicated-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxDuplicatedCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxDuplicatedCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxDuplicatedCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxDuplicatedCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxErrNoFrameCount */ class ReadThreadNetworkDiagnosticsRxErrNoFrameCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxErrNoFrameCount() : ReadAttribute("rx-err-no-frame-count") { } ~ReadThreadNetworkDiagnosticsRxErrNoFrameCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrNoFrameCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxErrNoFrameCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrNoFrameCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxErrNoFrameCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxErrNoFrameCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxErrNoFrameCount() : SubscribeAttribute("rx-err-no-frame-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxErrNoFrameCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrNoFrameCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxErrNoFrameCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrNoFrameCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxErrUnknownNeighborCount */ class ReadThreadNetworkDiagnosticsRxErrUnknownNeighborCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxErrUnknownNeighborCount() : ReadAttribute("rx-err-unknown-neighbor-count") { } ~ReadThreadNetworkDiagnosticsRxErrUnknownNeighborCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrUnknownNeighborCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxErrUnknownNeighborCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrUnknownNeighborCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxErrUnknownNeighborCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxErrUnknownNeighborCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxErrUnknownNeighborCount() : SubscribeAttribute("rx-err-unknown-neighbor-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxErrUnknownNeighborCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrUnknownNeighborCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxErrUnknownNeighborCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrUnknownNeighborCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxErrInvalidSrcAddrCount */ class ReadThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount() : ReadAttribute("rx-err-invalid-src-addr-count") { } ~ReadThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrInvalidSrcAddrCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxErrInvalidSrcAddrCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrInvalidSrcAddrCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxErrInvalidSrcAddrCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount() : SubscribeAttribute("rx-err-invalid-src-addr-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrInvalidSrcAddrCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxErrInvalidSrcAddrCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrInvalidSrcAddrCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxErrSecCount */ class ReadThreadNetworkDiagnosticsRxErrSecCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxErrSecCount() : ReadAttribute("rx-err-sec-count") { } ~ReadThreadNetworkDiagnosticsRxErrSecCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrSecCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxErrSecCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrSecCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxErrSecCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxErrSecCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxErrSecCount() : SubscribeAttribute("rx-err-sec-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxErrSecCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrSecCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxErrSecCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrSecCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxErrFcsCount */ class ReadThreadNetworkDiagnosticsRxErrFcsCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxErrFcsCount() : ReadAttribute("rx-err-fcs-count") { } ~ReadThreadNetworkDiagnosticsRxErrFcsCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrFcsCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxErrFcsCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrFcsCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxErrFcsCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxErrFcsCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxErrFcsCount() : SubscribeAttribute("rx-err-fcs-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxErrFcsCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrFcsCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxErrFcsCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrFcsCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RxErrOtherCount */ class ReadThreadNetworkDiagnosticsRxErrOtherCount : public ReadAttribute { public: ReadThreadNetworkDiagnosticsRxErrOtherCount() : ReadAttribute("rx-err-other-count") { } ~ReadThreadNetworkDiagnosticsRxErrOtherCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrOtherCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRxErrOtherCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrOtherCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics RxErrOtherCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsRxErrOtherCount : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsRxErrOtherCount() : SubscribeAttribute("rx-err-other-count") { } ~SubscribeAttributeThreadNetworkDiagnosticsRxErrOtherCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::RxErrOtherCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRxErrOtherCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrOtherCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ActiveTimestamp */ class ReadThreadNetworkDiagnosticsActiveTimestamp : public ReadAttribute { public: ReadThreadNetworkDiagnosticsActiveTimestamp() : ReadAttribute("active-timestamp") { } ~ReadThreadNetworkDiagnosticsActiveTimestamp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ActiveTimestamp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveTimestampWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ActiveTimestamp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics ActiveTimestamp read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsActiveTimestamp : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsActiveTimestamp() : SubscribeAttribute("active-timestamp") { } ~SubscribeAttributeThreadNetworkDiagnosticsActiveTimestamp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ActiveTimestamp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveTimestampWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ActiveTimestamp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PendingTimestamp */ class ReadThreadNetworkDiagnosticsPendingTimestamp : public ReadAttribute { public: ReadThreadNetworkDiagnosticsPendingTimestamp() : ReadAttribute("pending-timestamp") { } ~ReadThreadNetworkDiagnosticsPendingTimestamp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PendingTimestamp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePendingTimestampWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.PendingTimestamp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics PendingTimestamp read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsPendingTimestamp : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsPendingTimestamp() : SubscribeAttribute("pending-timestamp") { } ~SubscribeAttributeThreadNetworkDiagnosticsPendingTimestamp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::PendingTimestamp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePendingTimestampWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.PendingTimestamp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Delay */ class ReadThreadNetworkDiagnosticsDelay : public ReadAttribute { public: ReadThreadNetworkDiagnosticsDelay() : ReadAttribute("delay") { } ~ReadThreadNetworkDiagnosticsDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Delay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDelayWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.Delay response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics Delay read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsDelay : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsDelay() : SubscribeAttribute("delay") { } ~SubscribeAttributeThreadNetworkDiagnosticsDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::Delay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDelayWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.Delay response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SecurityPolicy */ class ReadThreadNetworkDiagnosticsSecurityPolicy : public ReadAttribute { public: ReadThreadNetworkDiagnosticsSecurityPolicy() : ReadAttribute("security-policy") { } ~ReadThreadNetworkDiagnosticsSecurityPolicy() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::SecurityPolicy::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSecurityPolicyWithCompletion:^(MTRThreadNetworkDiagnosticsClusterSecurityPolicy * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.SecurityPolicy response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics SecurityPolicy read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsSecurityPolicy : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsSecurityPolicy() : SubscribeAttribute("security-policy") { } ~SubscribeAttributeThreadNetworkDiagnosticsSecurityPolicy() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::SecurityPolicy::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSecurityPolicyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRThreadNetworkDiagnosticsClusterSecurityPolicy * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.SecurityPolicy response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ChannelPage0Mask */ class ReadThreadNetworkDiagnosticsChannelPage0Mask : public ReadAttribute { public: ReadThreadNetworkDiagnosticsChannelPage0Mask() : ReadAttribute("channel-page0mask") { } ~ReadThreadNetworkDiagnosticsChannelPage0Mask() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ChannelPage0Mask::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeChannelPage0MaskWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ChannelPage0Mask response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics ChannelPage0Mask read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsChannelPage0Mask : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsChannelPage0Mask() : SubscribeAttribute("channel-page0mask") { } ~SubscribeAttributeThreadNetworkDiagnosticsChannelPage0Mask() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ChannelPage0Mask::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeChannelPage0MaskWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ChannelPage0Mask response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OperationalDatasetComponents */ class ReadThreadNetworkDiagnosticsOperationalDatasetComponents : public ReadAttribute { public: ReadThreadNetworkDiagnosticsOperationalDatasetComponents() : ReadAttribute("operational-dataset-components") { } ~ReadThreadNetworkDiagnosticsOperationalDatasetComponents() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::OperationalDatasetComponents::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOperationalDatasetComponentsWithCompletion:^(MTRThreadNetworkDiagnosticsClusterOperationalDatasetComponents * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.OperationalDatasetComponents response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics OperationalDatasetComponents read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsOperationalDatasetComponents : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsOperationalDatasetComponents() : SubscribeAttribute("operational-dataset-components") { } ~SubscribeAttributeThreadNetworkDiagnosticsOperationalDatasetComponents() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::OperationalDatasetComponents::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOperationalDatasetComponentsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRThreadNetworkDiagnosticsClusterOperationalDatasetComponents * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.OperationalDatasetComponents response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ActiveNetworkFaultsList */ class ReadThreadNetworkDiagnosticsActiveNetworkFaultsList : public ReadAttribute { public: ReadThreadNetworkDiagnosticsActiveNetworkFaultsList() : ReadAttribute("active-network-faults-list") { } ~ReadThreadNetworkDiagnosticsActiveNetworkFaultsList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ActiveNetworkFaultsList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveNetworkFaultsListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ActiveNetworkFaultsList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics ActiveNetworkFaultsList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsActiveNetworkFaultsList : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsActiveNetworkFaultsList() : SubscribeAttribute("active-network-faults-list") { } ~SubscribeAttributeThreadNetworkDiagnosticsActiveNetworkFaultsList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ActiveNetworkFaultsList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveNetworkFaultsListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ActiveNetworkFaultsList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadThreadNetworkDiagnosticsGeneratedCommandList : public ReadAttribute { public: ReadThreadNetworkDiagnosticsGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadThreadNetworkDiagnosticsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeThreadNetworkDiagnosticsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadThreadNetworkDiagnosticsAcceptedCommandList : public ReadAttribute { public: ReadThreadNetworkDiagnosticsAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadThreadNetworkDiagnosticsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeThreadNetworkDiagnosticsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadThreadNetworkDiagnosticsEventList : public ReadAttribute { public: ReadThreadNetworkDiagnosticsEventList() : ReadAttribute("event-list") { } ~ReadThreadNetworkDiagnosticsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsEventList : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeThreadNetworkDiagnosticsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadThreadNetworkDiagnosticsAttributeList : public ReadAttribute { public: ReadThreadNetworkDiagnosticsAttributeList() : ReadAttribute("attribute-list") { } ~ReadThreadNetworkDiagnosticsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsAttributeList : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeThreadNetworkDiagnosticsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadThreadNetworkDiagnosticsFeatureMap : public ReadAttribute { public: ReadThreadNetworkDiagnosticsFeatureMap() : ReadAttribute("feature-map") { } ~ReadThreadNetworkDiagnosticsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsFeatureMap : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeThreadNetworkDiagnosticsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadThreadNetworkDiagnosticsClusterRevision : public ReadAttribute { public: ReadThreadNetworkDiagnosticsClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadThreadNetworkDiagnosticsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDiagnostics ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDiagnosticsClusterRevision : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDiagnosticsClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeThreadNetworkDiagnosticsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDiagnostics::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster WiFiNetworkDiagnostics | 0x0036 | |------------------------------------------------------------------------------| | Commands: | | | * ResetCounts | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * Bssid | 0x0000 | | * SecurityType | 0x0001 | | * WiFiVersion | 0x0002 | | * ChannelNumber | 0x0003 | | * Rssi | 0x0004 | | * BeaconLostCount | 0x0005 | | * BeaconRxCount | 0x0006 | | * PacketMulticastRxCount | 0x0007 | | * PacketMulticastTxCount | 0x0008 | | * PacketUnicastRxCount | 0x0009 | | * PacketUnicastTxCount | 0x000A | | * CurrentMaxRate | 0x000B | | * OverrunCount | 0x000C | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * Disconnection | 0x0000 | | * AssociationFailure | 0x0001 | | * ConnectionStatus | 0x0002 | \*----------------------------------------------------------------------------*/ /* * Command ResetCounts */ class WiFiNetworkDiagnosticsResetCounts : public ClusterCommand { public: WiFiNetworkDiagnosticsResetCounts() : ClusterCommand("reset-counts") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WiFiNetworkDiagnostics::Commands::ResetCounts::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWiFiNetworkDiagnosticsClusterResetCountsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster resetCountsWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Attribute Bssid */ class ReadWiFiNetworkDiagnosticsBssid : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsBssid() : ReadAttribute("bssid") { } ~ReadWiFiNetworkDiagnosticsBssid() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::Bssid::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBSSIDWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.BSSID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics BSSID read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsBssid : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsBssid() : SubscribeAttribute("bssid") { } ~SubscribeAttributeWiFiNetworkDiagnosticsBssid() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::Bssid::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBSSIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.BSSID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SecurityType */ class ReadWiFiNetworkDiagnosticsSecurityType : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsSecurityType() : ReadAttribute("security-type") { } ~ReadWiFiNetworkDiagnosticsSecurityType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::SecurityType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSecurityTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.SecurityType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics SecurityType read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsSecurityType : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsSecurityType() : SubscribeAttribute("security-type") { } ~SubscribeAttributeWiFiNetworkDiagnosticsSecurityType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::SecurityType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSecurityTypeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.SecurityType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute WiFiVersion */ class ReadWiFiNetworkDiagnosticsWiFiVersion : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsWiFiVersion() : ReadAttribute("wi-fi-version") { } ~ReadWiFiNetworkDiagnosticsWiFiVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::WiFiVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWiFiVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.WiFiVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics WiFiVersion read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsWiFiVersion : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsWiFiVersion() : SubscribeAttribute("wi-fi-version") { } ~SubscribeAttributeWiFiNetworkDiagnosticsWiFiVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::WiFiVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWiFiVersionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.WiFiVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ChannelNumber */ class ReadWiFiNetworkDiagnosticsChannelNumber : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsChannelNumber() : ReadAttribute("channel-number") { } ~ReadWiFiNetworkDiagnosticsChannelNumber() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::ChannelNumber::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeChannelNumberWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.ChannelNumber response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics ChannelNumber read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsChannelNumber : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsChannelNumber() : SubscribeAttribute("channel-number") { } ~SubscribeAttributeWiFiNetworkDiagnosticsChannelNumber() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::ChannelNumber::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeChannelNumberWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.ChannelNumber response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Rssi */ class ReadWiFiNetworkDiagnosticsRssi : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsRssi() : ReadAttribute("rssi") { } ~ReadWiFiNetworkDiagnosticsRssi() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::Rssi::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRSSIWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.RSSI response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics RSSI read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsRssi : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsRssi() : SubscribeAttribute("rssi") { } ~SubscribeAttributeWiFiNetworkDiagnosticsRssi() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::Rssi::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRSSIWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.RSSI response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BeaconLostCount */ class ReadWiFiNetworkDiagnosticsBeaconLostCount : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsBeaconLostCount() : ReadAttribute("beacon-lost-count") { } ~ReadWiFiNetworkDiagnosticsBeaconLostCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::BeaconLostCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBeaconLostCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.BeaconLostCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics BeaconLostCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsBeaconLostCount : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsBeaconLostCount() : SubscribeAttribute("beacon-lost-count") { } ~SubscribeAttributeWiFiNetworkDiagnosticsBeaconLostCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::BeaconLostCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBeaconLostCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.BeaconLostCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BeaconRxCount */ class ReadWiFiNetworkDiagnosticsBeaconRxCount : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsBeaconRxCount() : ReadAttribute("beacon-rx-count") { } ~ReadWiFiNetworkDiagnosticsBeaconRxCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::BeaconRxCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBeaconRxCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.BeaconRxCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics BeaconRxCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsBeaconRxCount : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsBeaconRxCount() : SubscribeAttribute("beacon-rx-count") { } ~SubscribeAttributeWiFiNetworkDiagnosticsBeaconRxCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::BeaconRxCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBeaconRxCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.BeaconRxCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PacketMulticastRxCount */ class ReadWiFiNetworkDiagnosticsPacketMulticastRxCount : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsPacketMulticastRxCount() : ReadAttribute("packet-multicast-rx-count") { } ~ReadWiFiNetworkDiagnosticsPacketMulticastRxCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketMulticastRxCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePacketMulticastRxCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.PacketMulticastRxCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics PacketMulticastRxCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastRxCount : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastRxCount() : SubscribeAttribute("packet-multicast-rx-count") { } ~SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastRxCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketMulticastRxCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePacketMulticastRxCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.PacketMulticastRxCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PacketMulticastTxCount */ class ReadWiFiNetworkDiagnosticsPacketMulticastTxCount : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsPacketMulticastTxCount() : ReadAttribute("packet-multicast-tx-count") { } ~ReadWiFiNetworkDiagnosticsPacketMulticastTxCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketMulticastTxCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePacketMulticastTxCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.PacketMulticastTxCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics PacketMulticastTxCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastTxCount : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastTxCount() : SubscribeAttribute("packet-multicast-tx-count") { } ~SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastTxCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketMulticastTxCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePacketMulticastTxCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.PacketMulticastTxCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PacketUnicastRxCount */ class ReadWiFiNetworkDiagnosticsPacketUnicastRxCount : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsPacketUnicastRxCount() : ReadAttribute("packet-unicast-rx-count") { } ~ReadWiFiNetworkDiagnosticsPacketUnicastRxCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketUnicastRxCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePacketUnicastRxCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.PacketUnicastRxCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics PacketUnicastRxCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastRxCount : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastRxCount() : SubscribeAttribute("packet-unicast-rx-count") { } ~SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastRxCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketUnicastRxCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePacketUnicastRxCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.PacketUnicastRxCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PacketUnicastTxCount */ class ReadWiFiNetworkDiagnosticsPacketUnicastTxCount : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsPacketUnicastTxCount() : ReadAttribute("packet-unicast-tx-count") { } ~ReadWiFiNetworkDiagnosticsPacketUnicastTxCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketUnicastTxCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePacketUnicastTxCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.PacketUnicastTxCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics PacketUnicastTxCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastTxCount : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastTxCount() : SubscribeAttribute("packet-unicast-tx-count") { } ~SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastTxCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::PacketUnicastTxCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePacketUnicastTxCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.PacketUnicastTxCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentMaxRate */ class ReadWiFiNetworkDiagnosticsCurrentMaxRate : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsCurrentMaxRate() : ReadAttribute("current-max-rate") { } ~ReadWiFiNetworkDiagnosticsCurrentMaxRate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::CurrentMaxRate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentMaxRateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.CurrentMaxRate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics CurrentMaxRate read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsCurrentMaxRate : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsCurrentMaxRate() : SubscribeAttribute("current-max-rate") { } ~SubscribeAttributeWiFiNetworkDiagnosticsCurrentMaxRate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::CurrentMaxRate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentMaxRateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.CurrentMaxRate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OverrunCount */ class ReadWiFiNetworkDiagnosticsOverrunCount : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsOverrunCount() : ReadAttribute("overrun-count") { } ~ReadWiFiNetworkDiagnosticsOverrunCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::OverrunCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOverrunCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.OverrunCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics OverrunCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsOverrunCount : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsOverrunCount() : SubscribeAttribute("overrun-count") { } ~SubscribeAttributeWiFiNetworkDiagnosticsOverrunCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::OverrunCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOverrunCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.OverrunCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadWiFiNetworkDiagnosticsGeneratedCommandList : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadWiFiNetworkDiagnosticsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeWiFiNetworkDiagnosticsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadWiFiNetworkDiagnosticsAcceptedCommandList : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadWiFiNetworkDiagnosticsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeWiFiNetworkDiagnosticsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadWiFiNetworkDiagnosticsEventList : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsEventList() : ReadAttribute("event-list") { } ~ReadWiFiNetworkDiagnosticsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsEventList : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeWiFiNetworkDiagnosticsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadWiFiNetworkDiagnosticsAttributeList : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsAttributeList() : ReadAttribute("attribute-list") { } ~ReadWiFiNetworkDiagnosticsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsAttributeList : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeWiFiNetworkDiagnosticsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadWiFiNetworkDiagnosticsFeatureMap : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsFeatureMap() : ReadAttribute("feature-map") { } ~ReadWiFiNetworkDiagnosticsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsFeatureMap : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeWiFiNetworkDiagnosticsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadWiFiNetworkDiagnosticsClusterRevision : public ReadAttribute { public: ReadWiFiNetworkDiagnosticsClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadWiFiNetworkDiagnosticsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkDiagnostics ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkDiagnosticsClusterRevision : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkDiagnosticsClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeWiFiNetworkDiagnosticsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkDiagnostics::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster EthernetNetworkDiagnostics | 0x0037 | |------------------------------------------------------------------------------| | Commands: | | | * ResetCounts | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * PHYRate | 0x0000 | | * FullDuplex | 0x0001 | | * PacketRxCount | 0x0002 | | * PacketTxCount | 0x0003 | | * TxErrCount | 0x0004 | | * CollisionCount | 0x0005 | | * OverrunCount | 0x0006 | | * CarrierDetect | 0x0007 | | * TimeSinceReset | 0x0008 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command ResetCounts */ class EthernetNetworkDiagnosticsResetCounts : public ClusterCommand { public: EthernetNetworkDiagnosticsResetCounts() : ClusterCommand("reset-counts") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::CommandId commandId = chip::app::Clusters::EthernetNetworkDiagnostics::Commands::ResetCounts::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTREthernetNetworkDiagnosticsClusterResetCountsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster resetCountsWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Attribute PHYRate */ class ReadEthernetNetworkDiagnosticsPHYRate : public ReadAttribute { public: ReadEthernetNetworkDiagnosticsPHYRate() : ReadAttribute("phyrate") { } ~ReadEthernetNetworkDiagnosticsPHYRate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::PHYRate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePHYRateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.PHYRate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EthernetNetworkDiagnostics PHYRate read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEthernetNetworkDiagnosticsPHYRate : public SubscribeAttribute { public: SubscribeAttributeEthernetNetworkDiagnosticsPHYRate() : SubscribeAttribute("phyrate") { } ~SubscribeAttributeEthernetNetworkDiagnosticsPHYRate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::PHYRate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePHYRateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.PHYRate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FullDuplex */ class ReadEthernetNetworkDiagnosticsFullDuplex : public ReadAttribute { public: ReadEthernetNetworkDiagnosticsFullDuplex() : ReadAttribute("full-duplex") { } ~ReadEthernetNetworkDiagnosticsFullDuplex() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::FullDuplex::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFullDuplexWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.FullDuplex response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EthernetNetworkDiagnostics FullDuplex read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEthernetNetworkDiagnosticsFullDuplex : public SubscribeAttribute { public: SubscribeAttributeEthernetNetworkDiagnosticsFullDuplex() : SubscribeAttribute("full-duplex") { } ~SubscribeAttributeEthernetNetworkDiagnosticsFullDuplex() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::FullDuplex::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFullDuplexWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.FullDuplex response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PacketRxCount */ class ReadEthernetNetworkDiagnosticsPacketRxCount : public ReadAttribute { public: ReadEthernetNetworkDiagnosticsPacketRxCount() : ReadAttribute("packet-rx-count") { } ~ReadEthernetNetworkDiagnosticsPacketRxCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::PacketRxCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePacketRxCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.PacketRxCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EthernetNetworkDiagnostics PacketRxCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEthernetNetworkDiagnosticsPacketRxCount : public SubscribeAttribute { public: SubscribeAttributeEthernetNetworkDiagnosticsPacketRxCount() : SubscribeAttribute("packet-rx-count") { } ~SubscribeAttributeEthernetNetworkDiagnosticsPacketRxCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::PacketRxCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePacketRxCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.PacketRxCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PacketTxCount */ class ReadEthernetNetworkDiagnosticsPacketTxCount : public ReadAttribute { public: ReadEthernetNetworkDiagnosticsPacketTxCount() : ReadAttribute("packet-tx-count") { } ~ReadEthernetNetworkDiagnosticsPacketTxCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::PacketTxCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePacketTxCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.PacketTxCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EthernetNetworkDiagnostics PacketTxCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEthernetNetworkDiagnosticsPacketTxCount : public SubscribeAttribute { public: SubscribeAttributeEthernetNetworkDiagnosticsPacketTxCount() : SubscribeAttribute("packet-tx-count") { } ~SubscribeAttributeEthernetNetworkDiagnosticsPacketTxCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::PacketTxCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePacketTxCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.PacketTxCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TxErrCount */ class ReadEthernetNetworkDiagnosticsTxErrCount : public ReadAttribute { public: ReadEthernetNetworkDiagnosticsTxErrCount() : ReadAttribute("tx-err-count") { } ~ReadEthernetNetworkDiagnosticsTxErrCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::TxErrCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTxErrCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.TxErrCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EthernetNetworkDiagnostics TxErrCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEthernetNetworkDiagnosticsTxErrCount : public SubscribeAttribute { public: SubscribeAttributeEthernetNetworkDiagnosticsTxErrCount() : SubscribeAttribute("tx-err-count") { } ~SubscribeAttributeEthernetNetworkDiagnosticsTxErrCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::TxErrCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTxErrCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.TxErrCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CollisionCount */ class ReadEthernetNetworkDiagnosticsCollisionCount : public ReadAttribute { public: ReadEthernetNetworkDiagnosticsCollisionCount() : ReadAttribute("collision-count") { } ~ReadEthernetNetworkDiagnosticsCollisionCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::CollisionCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCollisionCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.CollisionCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EthernetNetworkDiagnostics CollisionCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEthernetNetworkDiagnosticsCollisionCount : public SubscribeAttribute { public: SubscribeAttributeEthernetNetworkDiagnosticsCollisionCount() : SubscribeAttribute("collision-count") { } ~SubscribeAttributeEthernetNetworkDiagnosticsCollisionCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::CollisionCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCollisionCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.CollisionCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OverrunCount */ class ReadEthernetNetworkDiagnosticsOverrunCount : public ReadAttribute { public: ReadEthernetNetworkDiagnosticsOverrunCount() : ReadAttribute("overrun-count") { } ~ReadEthernetNetworkDiagnosticsOverrunCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::OverrunCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOverrunCountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.OverrunCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EthernetNetworkDiagnostics OverrunCount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEthernetNetworkDiagnosticsOverrunCount : public SubscribeAttribute { public: SubscribeAttributeEthernetNetworkDiagnosticsOverrunCount() : SubscribeAttribute("overrun-count") { } ~SubscribeAttributeEthernetNetworkDiagnosticsOverrunCount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::OverrunCount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOverrunCountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.OverrunCount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CarrierDetect */ class ReadEthernetNetworkDiagnosticsCarrierDetect : public ReadAttribute { public: ReadEthernetNetworkDiagnosticsCarrierDetect() : ReadAttribute("carrier-detect") { } ~ReadEthernetNetworkDiagnosticsCarrierDetect() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::CarrierDetect::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCarrierDetectWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.CarrierDetect response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EthernetNetworkDiagnostics CarrierDetect read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEthernetNetworkDiagnosticsCarrierDetect : public SubscribeAttribute { public: SubscribeAttributeEthernetNetworkDiagnosticsCarrierDetect() : SubscribeAttribute("carrier-detect") { } ~SubscribeAttributeEthernetNetworkDiagnosticsCarrierDetect() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::CarrierDetect::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCarrierDetectWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.CarrierDetect response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TimeSinceReset */ class ReadEthernetNetworkDiagnosticsTimeSinceReset : public ReadAttribute { public: ReadEthernetNetworkDiagnosticsTimeSinceReset() : ReadAttribute("time-since-reset") { } ~ReadEthernetNetworkDiagnosticsTimeSinceReset() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::TimeSinceReset::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTimeSinceResetWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.TimeSinceReset response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EthernetNetworkDiagnostics TimeSinceReset read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEthernetNetworkDiagnosticsTimeSinceReset : public SubscribeAttribute { public: SubscribeAttributeEthernetNetworkDiagnosticsTimeSinceReset() : SubscribeAttribute("time-since-reset") { } ~SubscribeAttributeEthernetNetworkDiagnosticsTimeSinceReset() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::TimeSinceReset::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTimeSinceResetWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.TimeSinceReset response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadEthernetNetworkDiagnosticsGeneratedCommandList : public ReadAttribute { public: ReadEthernetNetworkDiagnosticsGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadEthernetNetworkDiagnosticsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EthernetNetworkDiagnostics GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEthernetNetworkDiagnosticsGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeEthernetNetworkDiagnosticsGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeEthernetNetworkDiagnosticsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadEthernetNetworkDiagnosticsAcceptedCommandList : public ReadAttribute { public: ReadEthernetNetworkDiagnosticsAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadEthernetNetworkDiagnosticsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EthernetNetworkDiagnostics AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEthernetNetworkDiagnosticsAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeEthernetNetworkDiagnosticsAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeEthernetNetworkDiagnosticsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadEthernetNetworkDiagnosticsEventList : public ReadAttribute { public: ReadEthernetNetworkDiagnosticsEventList() : ReadAttribute("event-list") { } ~ReadEthernetNetworkDiagnosticsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EthernetNetworkDiagnostics EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEthernetNetworkDiagnosticsEventList : public SubscribeAttribute { public: SubscribeAttributeEthernetNetworkDiagnosticsEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeEthernetNetworkDiagnosticsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadEthernetNetworkDiagnosticsAttributeList : public ReadAttribute { public: ReadEthernetNetworkDiagnosticsAttributeList() : ReadAttribute("attribute-list") { } ~ReadEthernetNetworkDiagnosticsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EthernetNetworkDiagnostics AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEthernetNetworkDiagnosticsAttributeList : public SubscribeAttribute { public: SubscribeAttributeEthernetNetworkDiagnosticsAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeEthernetNetworkDiagnosticsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadEthernetNetworkDiagnosticsFeatureMap : public ReadAttribute { public: ReadEthernetNetworkDiagnosticsFeatureMap() : ReadAttribute("feature-map") { } ~ReadEthernetNetworkDiagnosticsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EthernetNetworkDiagnostics FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEthernetNetworkDiagnosticsFeatureMap : public SubscribeAttribute { public: SubscribeAttributeEthernetNetworkDiagnosticsFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeEthernetNetworkDiagnosticsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadEthernetNetworkDiagnosticsClusterRevision : public ReadAttribute { public: ReadEthernetNetworkDiagnosticsClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadEthernetNetworkDiagnosticsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EthernetNetworkDiagnostics ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEthernetNetworkDiagnosticsClusterRevision : public SubscribeAttribute { public: SubscribeAttributeEthernetNetworkDiagnosticsClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeEthernetNetworkDiagnosticsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EthernetNetworkDiagnostics::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EthernetNetworkDiagnostics::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster TimeSynchronization | 0x0038 | |------------------------------------------------------------------------------| | Commands: | | | * SetUTCTime | 0x00 | | * SetTrustedTimeSource | 0x01 | | * SetTimeZone | 0x02 | | * SetDSTOffset | 0x04 | | * SetDefaultNTP | 0x05 | |------------------------------------------------------------------------------| | Attributes: | | | * UTCTime | 0x0000 | | * Granularity | 0x0001 | | * TimeSource | 0x0002 | | * TrustedTimeSource | 0x0003 | | * DefaultNTP | 0x0004 | | * TimeZone | 0x0005 | | * DSTOffset | 0x0006 | | * LocalTime | 0x0007 | | * TimeZoneDatabase | 0x0008 | | * NTPServerAvailable | 0x0009 | | * TimeZoneListMaxSize | 0x000A | | * DSTOffsetListMaxSize | 0x000B | | * SupportsDNSResolve | 0x000C | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * DSTTableEmpty | 0x0000 | | * DSTStatus | 0x0001 | | * TimeZoneStatus | 0x0002 | | * TimeFailure | 0x0003 | | * MissingTrustedTimeSource | 0x0004 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command SetUTCTime */ class TimeSynchronizationSetUTCTime : public ClusterCommand { public: TimeSynchronizationSetUTCTime() : ClusterCommand("set-utctime") { AddArgument("UTCTime", 0, UINT64_MAX, &mRequest.UTCTime); AddArgument("Granularity", 0, UINT8_MAX, &mRequest.granularity); AddArgument("TimeSource", 0, UINT8_MAX, &mRequest.timeSource); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId commandId = chip::app::Clusters::TimeSynchronization::Commands::SetUTCTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRTimeSynchronizationClusterSetUTCTimeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.utcTime = [NSNumber numberWithUnsignedLongLong:mRequest.UTCTime]; params.granularity = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.granularity)]; if (mRequest.timeSource.HasValue()) { params.timeSource = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.timeSource.Value())]; } else { params.timeSource = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setUTCTimeWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::TimeSynchronization::Commands::SetUTCTime::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetTrustedTimeSource */ class TimeSynchronizationSetTrustedTimeSource : public ClusterCommand { public: TimeSynchronizationSetTrustedTimeSource() : ClusterCommand("set-trusted-time-source") , mComplex_TrustedTimeSource(&mRequest.trustedTimeSource) { #if MTR_ENABLE_PROVISIONAL AddArgument("TrustedTimeSource", &mComplex_TrustedTimeSource); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId commandId = chip::app::Clusters::TimeSynchronization::Commands::SetTrustedTimeSource::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRTimeSynchronizationClusterSetTrustedTimeSourceParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.trustedTimeSource.IsNull()) { params.trustedTimeSource = nil; } else { params.trustedTimeSource = [MTRTimeSynchronizationClusterFabricScopedTrustedTimeSourceStruct new]; params.trustedTimeSource.nodeID = [NSNumber numberWithUnsignedLongLong:mRequest.trustedTimeSource.Value().nodeID]; params.trustedTimeSource.endpoint = [NSNumber numberWithUnsignedShort:mRequest.trustedTimeSource.Value().endpoint]; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setTrustedTimeSourceWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::TimeSynchronization::Commands::SetTrustedTimeSource::Type mRequest; TypedComplexArgument> mComplex_TrustedTimeSource; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetTimeZone */ class TimeSynchronizationSetTimeZone : public ClusterCommand { public: TimeSynchronizationSetTimeZone() : ClusterCommand("set-time-zone") , mComplex_TimeZone(&mRequest.timeZone) { #if MTR_ENABLE_PROVISIONAL AddArgument("TimeZone", &mComplex_TimeZone); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId commandId = chip::app::Clusters::TimeSynchronization::Commands::SetTimeZone::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRTimeSynchronizationClusterSetTimeZoneParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.timeZone) { MTRTimeSynchronizationClusterTimeZoneStruct * newElement_0; newElement_0 = [MTRTimeSynchronizationClusterTimeZoneStruct new]; newElement_0.offset = [NSNumber numberWithInt:entry_0.offset]; newElement_0.validAt = [NSNumber numberWithUnsignedLongLong:entry_0.validAt]; if (entry_0.name.HasValue()) { newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.Value().data() length:entry_0.name.Value().size() encoding:NSUTF8StringEncoding]; } else { newElement_0.name = nil; } [array_0 addObject:newElement_0]; } params.timeZone = array_0; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setTimeZoneWithParams:params completion: ^(MTRTimeSynchronizationClusterSetTimeZoneResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::TimeSynchronization::Commands::SetTimeZoneResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::TimeSynchronization::Commands::SetTimeZoneResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::TimeSynchronization::Commands::SetTimeZone::Type mRequest; TypedComplexArgument> mComplex_TimeZone; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetDSTOffset */ class TimeSynchronizationSetDSTOffset : public ClusterCommand { public: TimeSynchronizationSetDSTOffset() : ClusterCommand("set-dstoffset") , mComplex_DSTOffset(&mRequest.DSTOffset) { #if MTR_ENABLE_PROVISIONAL AddArgument("DSTOffset", &mComplex_DSTOffset); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId commandId = chip::app::Clusters::TimeSynchronization::Commands::SetDSTOffset::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRTimeSynchronizationClusterSetDSTOffsetParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.DSTOffset) { MTRTimeSynchronizationClusterDSTOffsetStruct * newElement_0; newElement_0 = [MTRTimeSynchronizationClusterDSTOffsetStruct new]; newElement_0.offset = [NSNumber numberWithInt:entry_0.offset]; newElement_0.validStarting = [NSNumber numberWithUnsignedLongLong:entry_0.validStarting]; if (entry_0.validUntil.IsNull()) { newElement_0.validUntil = nil; } else { newElement_0.validUntil = [NSNumber numberWithUnsignedLongLong:entry_0.validUntil.Value()]; } [array_0 addObject:newElement_0]; } params.dstOffset = array_0; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setDSTOffsetWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::TimeSynchronization::Commands::SetDSTOffset::Type mRequest; TypedComplexArgument> mComplex_DSTOffset; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetDefaultNTP */ class TimeSynchronizationSetDefaultNTP : public ClusterCommand { public: TimeSynchronizationSetDefaultNTP() : ClusterCommand("set-default-ntp") { #if MTR_ENABLE_PROVISIONAL AddArgument("DefaultNTP", &mRequest.defaultNTP); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId commandId = chip::app::Clusters::TimeSynchronization::Commands::SetDefaultNTP::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRTimeSynchronizationClusterSetDefaultNTPParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.defaultNTP.IsNull()) { params.defaultNTP = nil; } else { params.defaultNTP = [[NSString alloc] initWithBytes:mRequest.defaultNTP.Value().data() length:mRequest.defaultNTP.Value().size() encoding:NSUTF8StringEncoding]; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setDefaultNTPWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::TimeSynchronization::Commands::SetDefaultNTP::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute UTCTime */ class ReadTimeSynchronizationUTCTime : public ReadAttribute { public: ReadTimeSynchronizationUTCTime() : ReadAttribute("utctime") { } ~ReadTimeSynchronizationUTCTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::UTCTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUTCTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.UTCTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization UTCTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationUTCTime : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationUTCTime() : SubscribeAttribute("utctime") { } ~SubscribeAttributeTimeSynchronizationUTCTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::UTCTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUTCTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.UTCTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Granularity */ class ReadTimeSynchronizationGranularity : public ReadAttribute { public: ReadTimeSynchronizationGranularity() : ReadAttribute("granularity") { } ~ReadTimeSynchronizationGranularity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::Granularity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGranularityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.Granularity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization Granularity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationGranularity : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationGranularity() : SubscribeAttribute("granularity") { } ~SubscribeAttributeTimeSynchronizationGranularity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::Granularity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGranularityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.Granularity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute TimeSource */ class ReadTimeSynchronizationTimeSource : public ReadAttribute { public: ReadTimeSynchronizationTimeSource() : ReadAttribute("time-source") { } ~ReadTimeSynchronizationTimeSource() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::TimeSource::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTimeSourceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.TimeSource response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization TimeSource read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationTimeSource : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationTimeSource() : SubscribeAttribute("time-source") { } ~SubscribeAttributeTimeSynchronizationTimeSource() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::TimeSource::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTimeSourceWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.TimeSource response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute TrustedTimeSource */ class ReadTimeSynchronizationTrustedTimeSource : public ReadAttribute { public: ReadTimeSynchronizationTrustedTimeSource() : ReadAttribute("trusted-time-source") { } ~ReadTimeSynchronizationTrustedTimeSource() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::TrustedTimeSource::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTrustedTimeSourceWithCompletion:^(MTRTimeSynchronizationClusterTrustedTimeSourceStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.TrustedTimeSource response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization TrustedTimeSource read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationTrustedTimeSource : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationTrustedTimeSource() : SubscribeAttribute("trusted-time-source") { } ~SubscribeAttributeTimeSynchronizationTrustedTimeSource() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::TrustedTimeSource::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTrustedTimeSourceWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRTimeSynchronizationClusterTrustedTimeSourceStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.TrustedTimeSource response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute DefaultNTP */ class ReadTimeSynchronizationDefaultNTP : public ReadAttribute { public: ReadTimeSynchronizationDefaultNTP() : ReadAttribute("default-ntp") { } ~ReadTimeSynchronizationDefaultNTP() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::DefaultNTP::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDefaultNTPWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.DefaultNTP response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization DefaultNTP read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationDefaultNTP : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationDefaultNTP() : SubscribeAttribute("default-ntp") { } ~SubscribeAttributeTimeSynchronizationDefaultNTP() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::DefaultNTP::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDefaultNTPWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.DefaultNTP response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute TimeZone */ class ReadTimeSynchronizationTimeZone : public ReadAttribute { public: ReadTimeSynchronizationTimeZone() : ReadAttribute("time-zone") { } ~ReadTimeSynchronizationTimeZone() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::TimeZone::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTimeZoneWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.TimeZone response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization TimeZone read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationTimeZone : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationTimeZone() : SubscribeAttribute("time-zone") { } ~SubscribeAttributeTimeSynchronizationTimeZone() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::TimeZone::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTimeZoneWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.TimeZone response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute DSTOffset */ class ReadTimeSynchronizationDSTOffset : public ReadAttribute { public: ReadTimeSynchronizationDSTOffset() : ReadAttribute("dstoffset") { } ~ReadTimeSynchronizationDSTOffset() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::DSTOffset::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDSTOffsetWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.DSTOffset response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization DSTOffset read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationDSTOffset : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationDSTOffset() : SubscribeAttribute("dstoffset") { } ~SubscribeAttributeTimeSynchronizationDSTOffset() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::DSTOffset::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDSTOffsetWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.DSTOffset response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute LocalTime */ class ReadTimeSynchronizationLocalTime : public ReadAttribute { public: ReadTimeSynchronizationLocalTime() : ReadAttribute("local-time") { } ~ReadTimeSynchronizationLocalTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::LocalTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLocalTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.LocalTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization LocalTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationLocalTime : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationLocalTime() : SubscribeAttribute("local-time") { } ~SubscribeAttributeTimeSynchronizationLocalTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::LocalTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLocalTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.LocalTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute TimeZoneDatabase */ class ReadTimeSynchronizationTimeZoneDatabase : public ReadAttribute { public: ReadTimeSynchronizationTimeZoneDatabase() : ReadAttribute("time-zone-database") { } ~ReadTimeSynchronizationTimeZoneDatabase() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::TimeZoneDatabase::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTimeZoneDatabaseWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.TimeZoneDatabase response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization TimeZoneDatabase read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationTimeZoneDatabase : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationTimeZoneDatabase() : SubscribeAttribute("time-zone-database") { } ~SubscribeAttributeTimeSynchronizationTimeZoneDatabase() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::TimeZoneDatabase::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTimeZoneDatabaseWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.TimeZoneDatabase response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NTPServerAvailable */ class ReadTimeSynchronizationNTPServerAvailable : public ReadAttribute { public: ReadTimeSynchronizationNTPServerAvailable() : ReadAttribute("ntpserver-available") { } ~ReadTimeSynchronizationNTPServerAvailable() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::NTPServerAvailable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNTPServerAvailableWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.NTPServerAvailable response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization NTPServerAvailable read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationNTPServerAvailable : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationNTPServerAvailable() : SubscribeAttribute("ntpserver-available") { } ~SubscribeAttributeTimeSynchronizationNTPServerAvailable() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::NTPServerAvailable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNTPServerAvailableWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.NTPServerAvailable response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute TimeZoneListMaxSize */ class ReadTimeSynchronizationTimeZoneListMaxSize : public ReadAttribute { public: ReadTimeSynchronizationTimeZoneListMaxSize() : ReadAttribute("time-zone-list-max-size") { } ~ReadTimeSynchronizationTimeZoneListMaxSize() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::TimeZoneListMaxSize::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTimeZoneListMaxSizeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.TimeZoneListMaxSize response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization TimeZoneListMaxSize read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationTimeZoneListMaxSize : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationTimeZoneListMaxSize() : SubscribeAttribute("time-zone-list-max-size") { } ~SubscribeAttributeTimeSynchronizationTimeZoneListMaxSize() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::TimeZoneListMaxSize::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTimeZoneListMaxSizeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.TimeZoneListMaxSize response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute DSTOffsetListMaxSize */ class ReadTimeSynchronizationDSTOffsetListMaxSize : public ReadAttribute { public: ReadTimeSynchronizationDSTOffsetListMaxSize() : ReadAttribute("dstoffset-list-max-size") { } ~ReadTimeSynchronizationDSTOffsetListMaxSize() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::DSTOffsetListMaxSize::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDSTOffsetListMaxSizeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.DSTOffsetListMaxSize response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization DSTOffsetListMaxSize read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationDSTOffsetListMaxSize : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationDSTOffsetListMaxSize() : SubscribeAttribute("dstoffset-list-max-size") { } ~SubscribeAttributeTimeSynchronizationDSTOffsetListMaxSize() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::DSTOffsetListMaxSize::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDSTOffsetListMaxSizeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.DSTOffsetListMaxSize response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportsDNSResolve */ class ReadTimeSynchronizationSupportsDNSResolve : public ReadAttribute { public: ReadTimeSynchronizationSupportsDNSResolve() : ReadAttribute("supports-dnsresolve") { } ~ReadTimeSynchronizationSupportsDNSResolve() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::SupportsDNSResolve::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportsDNSResolveWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.SupportsDNSResolve response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization SupportsDNSResolve read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationSupportsDNSResolve : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationSupportsDNSResolve() : SubscribeAttribute("supports-dnsresolve") { } ~SubscribeAttributeTimeSynchronizationSupportsDNSResolve() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::SupportsDNSResolve::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportsDNSResolveWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.SupportsDNSResolve response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadTimeSynchronizationGeneratedCommandList : public ReadAttribute { public: ReadTimeSynchronizationGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadTimeSynchronizationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeTimeSynchronizationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadTimeSynchronizationAcceptedCommandList : public ReadAttribute { public: ReadTimeSynchronizationAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadTimeSynchronizationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeTimeSynchronizationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadTimeSynchronizationEventList : public ReadAttribute { public: ReadTimeSynchronizationEventList() : ReadAttribute("event-list") { } ~ReadTimeSynchronizationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationEventList : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeTimeSynchronizationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadTimeSynchronizationAttributeList : public ReadAttribute { public: ReadTimeSynchronizationAttributeList() : ReadAttribute("attribute-list") { } ~ReadTimeSynchronizationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationAttributeList : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeTimeSynchronizationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadTimeSynchronizationFeatureMap : public ReadAttribute { public: ReadTimeSynchronizationFeatureMap() : ReadAttribute("feature-map") { } ~ReadTimeSynchronizationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationFeatureMap : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeTimeSynchronizationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadTimeSynchronizationClusterRevision : public ReadAttribute { public: ReadTimeSynchronizationClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadTimeSynchronizationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TimeSynchronization ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimeSynchronizationClusterRevision : public SubscribeAttribute { public: SubscribeAttributeTimeSynchronizationClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeTimeSynchronizationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TimeSynchronization::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TimeSynchronization::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeSynchronization.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster BridgedDeviceBasicInformation | 0x0039 | |------------------------------------------------------------------------------| | Commands: | | | * KeepActive | 0x80 | |------------------------------------------------------------------------------| | Attributes: | | | * VendorName | 0x0001 | | * VendorID | 0x0002 | | * ProductName | 0x0003 | | * ProductID | 0x0004 | | * NodeLabel | 0x0005 | | * HardwareVersion | 0x0007 | | * HardwareVersionString | 0x0008 | | * SoftwareVersion | 0x0009 | | * SoftwareVersionString | 0x000A | | * ManufacturingDate | 0x000B | | * PartNumber | 0x000C | | * ProductURL | 0x000D | | * ProductLabel | 0x000E | | * SerialNumber | 0x000F | | * Reachable | 0x0011 | | * UniqueID | 0x0012 | | * ProductAppearance | 0x0014 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * StartUp | 0x0000 | | * ShutDown | 0x0001 | | * Leave | 0x0002 | | * ReachableChanged | 0x0003 | | * ActiveChanged | 0x0080 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command KeepActive */ class BridgedDeviceBasicInformationKeepActive : public ClusterCommand { public: BridgedDeviceBasicInformationKeepActive() : ClusterCommand("keep-active") { #if MTR_ENABLE_PROVISIONAL AddArgument("StayActiveDuration", 0, UINT32_MAX, &mRequest.stayActiveDuration); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("TimeoutMs", 0, UINT32_MAX, &mRequest.timeoutMs); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId commandId = chip::app::Clusters::BridgedDeviceBasicInformation::Commands::KeepActive::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRBridgedDeviceBasicInformationClusterKeepActiveParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.stayActiveDuration = [NSNumber numberWithUnsignedInt:mRequest.stayActiveDuration]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.timeoutMs = [NSNumber numberWithUnsignedInt:mRequest.timeoutMs]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster keepActiveWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::BridgedDeviceBasicInformation::Commands::KeepActive::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute VendorName */ class ReadBridgedDeviceBasicInformationVendorName : public ReadAttribute { public: ReadBridgedDeviceBasicInformationVendorName() : ReadAttribute("vendor-name") { } ~ReadBridgedDeviceBasicInformationVendorName() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::VendorName::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeVendorNameWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.VendorName response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation VendorName read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationVendorName : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationVendorName() : SubscribeAttribute("vendor-name") { } ~SubscribeAttributeBridgedDeviceBasicInformationVendorName() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::VendorName::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeVendorNameWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.VendorName response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute VendorID */ class ReadBridgedDeviceBasicInformationVendorID : public ReadAttribute { public: ReadBridgedDeviceBasicInformationVendorID() : ReadAttribute("vendor-id") { } ~ReadBridgedDeviceBasicInformationVendorID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::VendorID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeVendorIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.VendorID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation VendorID read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationVendorID : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationVendorID() : SubscribeAttribute("vendor-id") { } ~SubscribeAttributeBridgedDeviceBasicInformationVendorID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::VendorID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeVendorIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.VendorID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ProductName */ class ReadBridgedDeviceBasicInformationProductName : public ReadAttribute { public: ReadBridgedDeviceBasicInformationProductName() : ReadAttribute("product-name") { } ~ReadBridgedDeviceBasicInformationProductName() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductName::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeProductNameWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.ProductName response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation ProductName read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationProductName : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationProductName() : SubscribeAttribute("product-name") { } ~SubscribeAttributeBridgedDeviceBasicInformationProductName() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductName::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeProductNameWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.ProductName response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute ProductID */ class ReadBridgedDeviceBasicInformationProductID : public ReadAttribute { public: ReadBridgedDeviceBasicInformationProductID() : ReadAttribute("product-id") { } ~ReadBridgedDeviceBasicInformationProductID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeProductIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.ProductID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation ProductID read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationProductID : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationProductID() : SubscribeAttribute("product-id") { } ~SubscribeAttributeBridgedDeviceBasicInformationProductID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeProductIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.ProductID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute NodeLabel */ class ReadBridgedDeviceBasicInformationNodeLabel : public ReadAttribute { public: ReadBridgedDeviceBasicInformationNodeLabel() : ReadAttribute("node-label") { } ~ReadBridgedDeviceBasicInformationNodeLabel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::NodeLabel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNodeLabelWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.NodeLabel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation NodeLabel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteBridgedDeviceBasicInformationNodeLabel : public WriteAttribute { public: WriteBridgedDeviceBasicInformationNodeLabel() : WriteAttribute("node-label") { AddArgument("attr-name", "node-label"); AddArgument("attr-value", &mValue); WriteAttribute::AddArguments(); } ~WriteBridgedDeviceBasicInformationNodeLabel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::NodeLabel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() length:mValue.size() encoding:NSUTF8StringEncoding]; [cluster writeAttributeNodeLabelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("BridgedDeviceBasicInformation NodeLabel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::ByteSpan mValue; }; class SubscribeAttributeBridgedDeviceBasicInformationNodeLabel : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationNodeLabel() : SubscribeAttribute("node-label") { } ~SubscribeAttributeBridgedDeviceBasicInformationNodeLabel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::NodeLabel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNodeLabelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.NodeLabel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute HardwareVersion */ class ReadBridgedDeviceBasicInformationHardwareVersion : public ReadAttribute { public: ReadBridgedDeviceBasicInformationHardwareVersion() : ReadAttribute("hardware-version") { } ~ReadBridgedDeviceBasicInformationHardwareVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::HardwareVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeHardwareVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.HardwareVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation HardwareVersion read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationHardwareVersion : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationHardwareVersion() : SubscribeAttribute("hardware-version") { } ~SubscribeAttributeBridgedDeviceBasicInformationHardwareVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::HardwareVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeHardwareVersionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.HardwareVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute HardwareVersionString */ class ReadBridgedDeviceBasicInformationHardwareVersionString : public ReadAttribute { public: ReadBridgedDeviceBasicInformationHardwareVersionString() : ReadAttribute("hardware-version-string") { } ~ReadBridgedDeviceBasicInformationHardwareVersionString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::HardwareVersionString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeHardwareVersionStringWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.HardwareVersionString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation HardwareVersionString read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationHardwareVersionString : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationHardwareVersionString() : SubscribeAttribute("hardware-version-string") { } ~SubscribeAttributeBridgedDeviceBasicInformationHardwareVersionString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::HardwareVersionString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeHardwareVersionStringWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.HardwareVersionString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SoftwareVersion */ class ReadBridgedDeviceBasicInformationSoftwareVersion : public ReadAttribute { public: ReadBridgedDeviceBasicInformationSoftwareVersion() : ReadAttribute("software-version") { } ~ReadBridgedDeviceBasicInformationSoftwareVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::SoftwareVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSoftwareVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.SoftwareVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation SoftwareVersion read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationSoftwareVersion : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationSoftwareVersion() : SubscribeAttribute("software-version") { } ~SubscribeAttributeBridgedDeviceBasicInformationSoftwareVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::SoftwareVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSoftwareVersionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.SoftwareVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SoftwareVersionString */ class ReadBridgedDeviceBasicInformationSoftwareVersionString : public ReadAttribute { public: ReadBridgedDeviceBasicInformationSoftwareVersionString() : ReadAttribute("software-version-string") { } ~ReadBridgedDeviceBasicInformationSoftwareVersionString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::SoftwareVersionString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSoftwareVersionStringWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.SoftwareVersionString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation SoftwareVersionString read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationSoftwareVersionString : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationSoftwareVersionString() : SubscribeAttribute("software-version-string") { } ~SubscribeAttributeBridgedDeviceBasicInformationSoftwareVersionString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::SoftwareVersionString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSoftwareVersionStringWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.SoftwareVersionString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ManufacturingDate */ class ReadBridgedDeviceBasicInformationManufacturingDate : public ReadAttribute { public: ReadBridgedDeviceBasicInformationManufacturingDate() : ReadAttribute("manufacturing-date") { } ~ReadBridgedDeviceBasicInformationManufacturingDate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ManufacturingDate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeManufacturingDateWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.ManufacturingDate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation ManufacturingDate read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationManufacturingDate : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationManufacturingDate() : SubscribeAttribute("manufacturing-date") { } ~SubscribeAttributeBridgedDeviceBasicInformationManufacturingDate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ManufacturingDate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeManufacturingDateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.ManufacturingDate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PartNumber */ class ReadBridgedDeviceBasicInformationPartNumber : public ReadAttribute { public: ReadBridgedDeviceBasicInformationPartNumber() : ReadAttribute("part-number") { } ~ReadBridgedDeviceBasicInformationPartNumber() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::PartNumber::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePartNumberWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.PartNumber response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation PartNumber read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationPartNumber : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationPartNumber() : SubscribeAttribute("part-number") { } ~SubscribeAttributeBridgedDeviceBasicInformationPartNumber() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::PartNumber::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePartNumberWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.PartNumber response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ProductURL */ class ReadBridgedDeviceBasicInformationProductURL : public ReadAttribute { public: ReadBridgedDeviceBasicInformationProductURL() : ReadAttribute("product-url") { } ~ReadBridgedDeviceBasicInformationProductURL() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductURL::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeProductURLWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.ProductURL response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation ProductURL read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationProductURL : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationProductURL() : SubscribeAttribute("product-url") { } ~SubscribeAttributeBridgedDeviceBasicInformationProductURL() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductURL::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeProductURLWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.ProductURL response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ProductLabel */ class ReadBridgedDeviceBasicInformationProductLabel : public ReadAttribute { public: ReadBridgedDeviceBasicInformationProductLabel() : ReadAttribute("product-label") { } ~ReadBridgedDeviceBasicInformationProductLabel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductLabel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeProductLabelWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.ProductLabel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation ProductLabel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationProductLabel : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationProductLabel() : SubscribeAttribute("product-label") { } ~SubscribeAttributeBridgedDeviceBasicInformationProductLabel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductLabel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeProductLabelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.ProductLabel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SerialNumber */ class ReadBridgedDeviceBasicInformationSerialNumber : public ReadAttribute { public: ReadBridgedDeviceBasicInformationSerialNumber() : ReadAttribute("serial-number") { } ~ReadBridgedDeviceBasicInformationSerialNumber() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::SerialNumber::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSerialNumberWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.SerialNumber response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation SerialNumber read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationSerialNumber : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationSerialNumber() : SubscribeAttribute("serial-number") { } ~SubscribeAttributeBridgedDeviceBasicInformationSerialNumber() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::SerialNumber::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSerialNumberWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.SerialNumber response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Reachable */ class ReadBridgedDeviceBasicInformationReachable : public ReadAttribute { public: ReadBridgedDeviceBasicInformationReachable() : ReadAttribute("reachable") { } ~ReadBridgedDeviceBasicInformationReachable() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::Reachable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeReachableWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.Reachable response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation Reachable read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationReachable : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationReachable() : SubscribeAttribute("reachable") { } ~SubscribeAttributeBridgedDeviceBasicInformationReachable() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::Reachable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeReachableWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.Reachable response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute UniqueID */ class ReadBridgedDeviceBasicInformationUniqueID : public ReadAttribute { public: ReadBridgedDeviceBasicInformationUniqueID() : ReadAttribute("unique-id") { } ~ReadBridgedDeviceBasicInformationUniqueID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::UniqueID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUniqueIDWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.UniqueID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation UniqueID read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationUniqueID : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationUniqueID() : SubscribeAttribute("unique-id") { } ~SubscribeAttributeBridgedDeviceBasicInformationUniqueID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::UniqueID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUniqueIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.UniqueID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ProductAppearance */ class ReadBridgedDeviceBasicInformationProductAppearance : public ReadAttribute { public: ReadBridgedDeviceBasicInformationProductAppearance() : ReadAttribute("product-appearance") { } ~ReadBridgedDeviceBasicInformationProductAppearance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductAppearance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeProductAppearanceWithCompletion:^(MTRBridgedDeviceBasicInformationClusterProductAppearanceStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.ProductAppearance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation ProductAppearance read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationProductAppearance : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationProductAppearance() : SubscribeAttribute("product-appearance") { } ~SubscribeAttributeBridgedDeviceBasicInformationProductAppearance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ProductAppearance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeProductAppearanceWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRBridgedDeviceBasicInformationClusterProductAppearanceStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.ProductAppearance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadBridgedDeviceBasicInformationGeneratedCommandList : public ReadAttribute { public: ReadBridgedDeviceBasicInformationGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadBridgedDeviceBasicInformationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeBridgedDeviceBasicInformationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadBridgedDeviceBasicInformationAcceptedCommandList : public ReadAttribute { public: ReadBridgedDeviceBasicInformationAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadBridgedDeviceBasicInformationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeBridgedDeviceBasicInformationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadBridgedDeviceBasicInformationEventList : public ReadAttribute { public: ReadBridgedDeviceBasicInformationEventList() : ReadAttribute("event-list") { } ~ReadBridgedDeviceBasicInformationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationEventList : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeBridgedDeviceBasicInformationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadBridgedDeviceBasicInformationAttributeList : public ReadAttribute { public: ReadBridgedDeviceBasicInformationAttributeList() : ReadAttribute("attribute-list") { } ~ReadBridgedDeviceBasicInformationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationAttributeList : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeBridgedDeviceBasicInformationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadBridgedDeviceBasicInformationFeatureMap : public ReadAttribute { public: ReadBridgedDeviceBasicInformationFeatureMap() : ReadAttribute("feature-map") { } ~ReadBridgedDeviceBasicInformationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationFeatureMap : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeBridgedDeviceBasicInformationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadBridgedDeviceBasicInformationClusterRevision : public ReadAttribute { public: ReadBridgedDeviceBasicInformationClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadBridgedDeviceBasicInformationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BridgedDeviceBasicInformation ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBridgedDeviceBasicInformationClusterRevision : public SubscribeAttribute { public: SubscribeAttributeBridgedDeviceBasicInformationClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeBridgedDeviceBasicInformationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BridgedDeviceBasicInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BridgedDeviceBasicInformation::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBridgedDeviceBasicInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasicInformation.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster Switch | 0x003B | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * NumberOfPositions | 0x0000 | | * CurrentPosition | 0x0001 | | * MultiPressMax | 0x0002 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * SwitchLatched | 0x0000 | | * InitialPress | 0x0001 | | * LongPress | 0x0002 | | * ShortRelease | 0x0003 | | * LongRelease | 0x0004 | | * MultiPressOngoing | 0x0005 | | * MultiPressComplete | 0x0006 | \*----------------------------------------------------------------------------*/ /* * Attribute NumberOfPositions */ class ReadSwitchNumberOfPositions : public ReadAttribute { public: ReadSwitchNumberOfPositions() : ReadAttribute("number-of-positions") { } ~ReadSwitchNumberOfPositions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Switch::Attributes::NumberOfPositions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfPositionsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.NumberOfPositions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Switch NumberOfPositions read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSwitchNumberOfPositions : public SubscribeAttribute { public: SubscribeAttributeSwitchNumberOfPositions() : SubscribeAttribute("number-of-positions") { } ~SubscribeAttributeSwitchNumberOfPositions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Switch::Attributes::NumberOfPositions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfPositionsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.NumberOfPositions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentPosition */ class ReadSwitchCurrentPosition : public ReadAttribute { public: ReadSwitchCurrentPosition() : ReadAttribute("current-position") { } ~ReadSwitchCurrentPosition() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Switch::Attributes::CurrentPosition::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentPositionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.CurrentPosition response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Switch CurrentPosition read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSwitchCurrentPosition : public SubscribeAttribute { public: SubscribeAttributeSwitchCurrentPosition() : SubscribeAttribute("current-position") { } ~SubscribeAttributeSwitchCurrentPosition() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Switch::Attributes::CurrentPosition::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentPositionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.CurrentPosition response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MultiPressMax */ class ReadSwitchMultiPressMax : public ReadAttribute { public: ReadSwitchMultiPressMax() : ReadAttribute("multi-press-max") { } ~ReadSwitchMultiPressMax() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Switch::Attributes::MultiPressMax::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMultiPressMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.MultiPressMax response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Switch MultiPressMax read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSwitchMultiPressMax : public SubscribeAttribute { public: SubscribeAttributeSwitchMultiPressMax() : SubscribeAttribute("multi-press-max") { } ~SubscribeAttributeSwitchMultiPressMax() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Switch::Attributes::MultiPressMax::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMultiPressMaxWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.MultiPressMax response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadSwitchGeneratedCommandList : public ReadAttribute { public: ReadSwitchGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadSwitchGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Switch::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Switch GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSwitchGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeSwitchGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeSwitchGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Switch::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadSwitchAcceptedCommandList : public ReadAttribute { public: ReadSwitchAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadSwitchAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Switch::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Switch AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSwitchAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeSwitchAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeSwitchAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Switch::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadSwitchEventList : public ReadAttribute { public: ReadSwitchEventList() : ReadAttribute("event-list") { } ~ReadSwitchEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Switch::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Switch EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSwitchEventList : public SubscribeAttribute { public: SubscribeAttributeSwitchEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeSwitchEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Switch::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadSwitchAttributeList : public ReadAttribute { public: ReadSwitchAttributeList() : ReadAttribute("attribute-list") { } ~ReadSwitchAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Switch::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Switch AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSwitchAttributeList : public SubscribeAttribute { public: SubscribeAttributeSwitchAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeSwitchAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Switch::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadSwitchFeatureMap : public ReadAttribute { public: ReadSwitchFeatureMap() : ReadAttribute("feature-map") { } ~ReadSwitchFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Switch::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Switch FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSwitchFeatureMap : public SubscribeAttribute { public: SubscribeAttributeSwitchFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeSwitchFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Switch::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadSwitchClusterRevision : public ReadAttribute { public: ReadSwitchClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadSwitchClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Switch::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Switch ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSwitchClusterRevision : public SubscribeAttribute { public: SubscribeAttributeSwitchClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeSwitchClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Switch::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Switch::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSwitch alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster AdministratorCommissioning | 0x003C | |------------------------------------------------------------------------------| | Commands: | | | * OpenCommissioningWindow | 0x00 | | * OpenBasicCommissioningWindow | 0x01 | | * RevokeCommissioning | 0x02 | |------------------------------------------------------------------------------| | Attributes: | | | * WindowStatus | 0x0000 | | * AdminFabricIndex | 0x0001 | | * AdminVendorId | 0x0002 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command OpenCommissioningWindow */ class AdministratorCommissioningOpenCommissioningWindow : public ClusterCommand { public: AdministratorCommissioningOpenCommissioningWindow() : ClusterCommand("open-commissioning-window") { AddArgument("CommissioningTimeout", 0, UINT16_MAX, &mRequest.commissioningTimeout); AddArgument("PAKEPasscodeVerifier", &mRequest.PAKEPasscodeVerifier); AddArgument("Discriminator", 0, UINT16_MAX, &mRequest.discriminator); AddArgument("Iterations", 0, UINT32_MAX, &mRequest.iterations); AddArgument("Salt", &mRequest.salt); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::CommandId commandId = chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRAdministratorCommissioningClusterOpenCommissioningWindowParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.commissioningTimeout = [NSNumber numberWithUnsignedShort:mRequest.commissioningTimeout]; params.pakePasscodeVerifier = [NSData dataWithBytes:mRequest.PAKEPasscodeVerifier.data() length:mRequest.PAKEPasscodeVerifier.size()]; params.discriminator = [NSNumber numberWithUnsignedShort:mRequest.discriminator]; params.iterations = [NSNumber numberWithUnsignedInt:mRequest.iterations]; params.salt = [NSData dataWithBytes:mRequest.salt.data() length:mRequest.salt.size()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster openCommissioningWindowWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type mRequest; }; /* * Command OpenBasicCommissioningWindow */ class AdministratorCommissioningOpenBasicCommissioningWindow : public ClusterCommand { public: AdministratorCommissioningOpenBasicCommissioningWindow() : ClusterCommand("open-basic-commissioning-window") { AddArgument("CommissioningTimeout", 0, UINT16_MAX, &mRequest.commissioningTimeout); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::CommandId commandId = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRAdministratorCommissioningClusterOpenBasicCommissioningWindowParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.commissioningTimeout = [NSNumber numberWithUnsignedShort:mRequest.commissioningTimeout]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster openBasicCommissioningWindowWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type mRequest; }; /* * Command RevokeCommissioning */ class AdministratorCommissioningRevokeCommissioning : public ClusterCommand { public: AdministratorCommissioningRevokeCommissioning() : ClusterCommand("revoke-commissioning") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::CommandId commandId = chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRAdministratorCommissioningClusterRevokeCommissioningParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster revokeCommissioningWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Attribute WindowStatus */ class ReadAdministratorCommissioningWindowStatus : public ReadAttribute { public: ReadAdministratorCommissioningWindowStatus() : ReadAttribute("window-status") { } ~ReadAdministratorCommissioningWindowStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::WindowStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWindowStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.WindowStatus response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AdministratorCommissioning WindowStatus read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAdministratorCommissioningWindowStatus : public SubscribeAttribute { public: SubscribeAttributeAdministratorCommissioningWindowStatus() : SubscribeAttribute("window-status") { } ~SubscribeAttributeAdministratorCommissioningWindowStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::WindowStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWindowStatusWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.WindowStatus response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AdminFabricIndex */ class ReadAdministratorCommissioningAdminFabricIndex : public ReadAttribute { public: ReadAdministratorCommissioningAdminFabricIndex() : ReadAttribute("admin-fabric-index") { } ~ReadAdministratorCommissioningAdminFabricIndex() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::AdminFabricIndex::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAdminFabricIndexWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.AdminFabricIndex response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AdministratorCommissioning AdminFabricIndex read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAdministratorCommissioningAdminFabricIndex : public SubscribeAttribute { public: SubscribeAttributeAdministratorCommissioningAdminFabricIndex() : SubscribeAttribute("admin-fabric-index") { } ~SubscribeAttributeAdministratorCommissioningAdminFabricIndex() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::AdminFabricIndex::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAdminFabricIndexWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.AdminFabricIndex response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AdminVendorId */ class ReadAdministratorCommissioningAdminVendorId : public ReadAttribute { public: ReadAdministratorCommissioningAdminVendorId() : ReadAttribute("admin-vendor-id") { } ~ReadAdministratorCommissioningAdminVendorId() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::AdminVendorId::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAdminVendorIdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.AdminVendorId response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AdministratorCommissioning AdminVendorId read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAdministratorCommissioningAdminVendorId : public SubscribeAttribute { public: SubscribeAttributeAdministratorCommissioningAdminVendorId() : SubscribeAttribute("admin-vendor-id") { } ~SubscribeAttributeAdministratorCommissioningAdminVendorId() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::AdminVendorId::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAdminVendorIdWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.AdminVendorId response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadAdministratorCommissioningGeneratedCommandList : public ReadAttribute { public: ReadAdministratorCommissioningGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadAdministratorCommissioningGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AdministratorCommissioning GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAdministratorCommissioningGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeAdministratorCommissioningGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeAdministratorCommissioningGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadAdministratorCommissioningAcceptedCommandList : public ReadAttribute { public: ReadAdministratorCommissioningAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadAdministratorCommissioningAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AdministratorCommissioning AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAdministratorCommissioningAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeAdministratorCommissioningAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeAdministratorCommissioningAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadAdministratorCommissioningEventList : public ReadAttribute { public: ReadAdministratorCommissioningEventList() : ReadAttribute("event-list") { } ~ReadAdministratorCommissioningEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AdministratorCommissioning EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAdministratorCommissioningEventList : public SubscribeAttribute { public: SubscribeAttributeAdministratorCommissioningEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeAdministratorCommissioningEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadAdministratorCommissioningAttributeList : public ReadAttribute { public: ReadAdministratorCommissioningAttributeList() : ReadAttribute("attribute-list") { } ~ReadAdministratorCommissioningAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AdministratorCommissioning AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAdministratorCommissioningAttributeList : public SubscribeAttribute { public: SubscribeAttributeAdministratorCommissioningAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeAdministratorCommissioningAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadAdministratorCommissioningFeatureMap : public ReadAttribute { public: ReadAdministratorCommissioningFeatureMap() : ReadAttribute("feature-map") { } ~ReadAdministratorCommissioningFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AdministratorCommissioning FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAdministratorCommissioningFeatureMap : public SubscribeAttribute { public: SubscribeAttributeAdministratorCommissioningFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeAdministratorCommissioningFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadAdministratorCommissioningClusterRevision : public ReadAttribute { public: ReadAdministratorCommissioningClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadAdministratorCommissioningClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AdministratorCommissioning ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAdministratorCommissioningClusterRevision : public SubscribeAttribute { public: SubscribeAttributeAdministratorCommissioningClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeAdministratorCommissioningClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AdministratorCommissioning::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AdministratorCommissioning::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster OperationalCredentials | 0x003E | |------------------------------------------------------------------------------| | Commands: | | | * AttestationRequest | 0x00 | | * CertificateChainRequest | 0x02 | | * CSRRequest | 0x04 | | * AddNOC | 0x06 | | * UpdateNOC | 0x07 | | * UpdateFabricLabel | 0x09 | | * RemoveFabric | 0x0A | | * AddTrustedRootCertificate | 0x0B | |------------------------------------------------------------------------------| | Attributes: | | | * NOCs | 0x0000 | | * Fabrics | 0x0001 | | * SupportedFabrics | 0x0002 | | * CommissionedFabrics | 0x0003 | | * TrustedRootCertificates | 0x0004 | | * CurrentFabricIndex | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command AttestationRequest */ class OperationalCredentialsAttestationRequest : public ClusterCommand { public: OperationalCredentialsAttestationRequest() : ClusterCommand("attestation-request") { AddArgument("AttestationNonce", &mRequest.attestationNonce); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OperationalCredentials::Commands::AttestationRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROperationalCredentialsClusterAttestationRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.attestationNonce = [NSData dataWithBytes:mRequest.attestationNonce.data() length:mRequest.attestationNonce.size()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster attestationRequestWithParams:params completion: ^(MTROperationalCredentialsClusterAttestationResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OperationalCredentials::Commands::AttestationResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OperationalCredentials::Commands::AttestationResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::OperationalCredentials::Commands::AttestationRequest::Type mRequest; }; /* * Command CertificateChainRequest */ class OperationalCredentialsCertificateChainRequest : public ClusterCommand { public: OperationalCredentialsCertificateChainRequest() : ClusterCommand("certificate-chain-request") { AddArgument("CertificateType", 0, UINT8_MAX, &mRequest.certificateType); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OperationalCredentials::Commands::CertificateChainRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROperationalCredentialsClusterCertificateChainRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.certificateType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.certificateType)]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster certificateChainRequestWithParams:params completion: ^(MTROperationalCredentialsClusterCertificateChainResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OperationalCredentials::Commands::CertificateChainResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OperationalCredentials::Commands::CertificateChainResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::OperationalCredentials::Commands::CertificateChainRequest::Type mRequest; }; /* * Command CSRRequest */ class OperationalCredentialsCSRRequest : public ClusterCommand { public: OperationalCredentialsCSRRequest() : ClusterCommand("csrrequest") { AddArgument("CSRNonce", &mRequest.CSRNonce); AddArgument("IsForUpdateNOC", 0, 1, &mRequest.isForUpdateNOC); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OperationalCredentials::Commands::CSRRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROperationalCredentialsClusterCSRRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.csrNonce = [NSData dataWithBytes:mRequest.CSRNonce.data() length:mRequest.CSRNonce.size()]; if (mRequest.isForUpdateNOC.HasValue()) { params.isForUpdateNOC = [NSNumber numberWithBool:mRequest.isForUpdateNOC.Value()]; } else { params.isForUpdateNOC = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster CSRRequestWithParams:params completion: ^(MTROperationalCredentialsClusterCSRResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OperationalCredentials::Commands::CSRResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OperationalCredentials::Commands::CSRResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::OperationalCredentials::Commands::CSRRequest::Type mRequest; }; /* * Command AddNOC */ class OperationalCredentialsAddNOC : public ClusterCommand { public: OperationalCredentialsAddNOC() : ClusterCommand("add-noc") { AddArgument("NOCValue", &mRequest.NOCValue); AddArgument("ICACValue", &mRequest.ICACValue); AddArgument("IPKValue", &mRequest.IPKValue); AddArgument("CaseAdminSubject", 0, UINT64_MAX, &mRequest.caseAdminSubject); AddArgument("AdminVendorId", 0, UINT16_MAX, &mRequest.adminVendorId); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OperationalCredentials::Commands::AddNOC::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROperationalCredentialsClusterAddNOCParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.nocValue = [NSData dataWithBytes:mRequest.NOCValue.data() length:mRequest.NOCValue.size()]; if (mRequest.ICACValue.HasValue()) { params.icacValue = [NSData dataWithBytes:mRequest.ICACValue.Value().data() length:mRequest.ICACValue.Value().size()]; } else { params.icacValue = nil; } params.ipkValue = [NSData dataWithBytes:mRequest.IPKValue.data() length:mRequest.IPKValue.size()]; params.caseAdminSubject = [NSNumber numberWithUnsignedLongLong:mRequest.caseAdminSubject]; params.adminVendorId = [NSNumber numberWithUnsignedShort:chip::to_underlying(mRequest.adminVendorId)]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster addNOCWithParams:params completion: ^(MTROperationalCredentialsClusterNOCResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::OperationalCredentials::Commands::AddNOC::Type mRequest; }; /* * Command UpdateNOC */ class OperationalCredentialsUpdateNOC : public ClusterCommand { public: OperationalCredentialsUpdateNOC() : ClusterCommand("update-noc") { AddArgument("NOCValue", &mRequest.NOCValue); AddArgument("ICACValue", &mRequest.ICACValue); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OperationalCredentials::Commands::UpdateNOC::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROperationalCredentialsClusterUpdateNOCParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.nocValue = [NSData dataWithBytes:mRequest.NOCValue.data() length:mRequest.NOCValue.size()]; if (mRequest.ICACValue.HasValue()) { params.icacValue = [NSData dataWithBytes:mRequest.ICACValue.Value().data() length:mRequest.ICACValue.Value().size()]; } else { params.icacValue = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster updateNOCWithParams:params completion: ^(MTROperationalCredentialsClusterNOCResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::OperationalCredentials::Commands::UpdateNOC::Type mRequest; }; /* * Command UpdateFabricLabel */ class OperationalCredentialsUpdateFabricLabel : public ClusterCommand { public: OperationalCredentialsUpdateFabricLabel() : ClusterCommand("update-fabric-label") { AddArgument("Label", &mRequest.label); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OperationalCredentials::Commands::UpdateFabricLabel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROperationalCredentialsClusterUpdateFabricLabelParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.label = [[NSString alloc] initWithBytes:mRequest.label.data() length:mRequest.label.size() encoding:NSUTF8StringEncoding]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster updateFabricLabelWithParams:params completion: ^(MTROperationalCredentialsClusterNOCResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::OperationalCredentials::Commands::UpdateFabricLabel::Type mRequest; }; /* * Command RemoveFabric */ class OperationalCredentialsRemoveFabric : public ClusterCommand { public: OperationalCredentialsRemoveFabric() : ClusterCommand("remove-fabric") { AddArgument("FabricIndex", 0, UINT8_MAX, &mRequest.fabricIndex); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROperationalCredentialsClusterRemoveFabricParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.fabricIndex = [NSNumber numberWithUnsignedChar:mRequest.fabricIndex]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster removeFabricWithParams:params completion: ^(MTROperationalCredentialsClusterNOCResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OperationalCredentials::Commands::NOCResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::OperationalCredentials::Commands::RemoveFabric::Type mRequest; }; /* * Command AddTrustedRootCertificate */ class OperationalCredentialsAddTrustedRootCertificate : public ClusterCommand { public: OperationalCredentialsAddTrustedRootCertificate() : ClusterCommand("add-trusted-root-certificate") { AddArgument("RootCACertificate", &mRequest.rootCACertificate); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OperationalCredentials::Commands::AddTrustedRootCertificate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROperationalCredentialsClusterAddTrustedRootCertificateParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.rootCACertificate = [NSData dataWithBytes:mRequest.rootCACertificate.data() length:mRequest.rootCACertificate.size()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster addTrustedRootCertificateWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::OperationalCredentials::Commands::AddTrustedRootCertificate::Type mRequest; }; /* * Attribute NOCs */ class ReadOperationalCredentialsNOCs : public ReadAttribute { public: ReadOperationalCredentialsNOCs() : ReadAttribute("nocs") { } ~ReadOperationalCredentialsNOCs() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::NOCs::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRReadParams alloc] init]; if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } [cluster readAttributeNOCsWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.NOCs response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalCredentials NOCs read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalCredentialsNOCs : public SubscribeAttribute { public: SubscribeAttributeOperationalCredentialsNOCs() : SubscribeAttribute("nocs") { } ~SubscribeAttributeOperationalCredentialsNOCs() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::NOCs::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNOCsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.NOCs response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Fabrics */ class ReadOperationalCredentialsFabrics : public ReadAttribute { public: ReadOperationalCredentialsFabrics() : ReadAttribute("fabrics") { } ~ReadOperationalCredentialsFabrics() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::Fabrics::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRReadParams alloc] init]; if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } [cluster readAttributeFabricsWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.Fabrics response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalCredentials Fabrics read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalCredentialsFabrics : public SubscribeAttribute { public: SubscribeAttributeOperationalCredentialsFabrics() : SubscribeAttribute("fabrics") { } ~SubscribeAttributeOperationalCredentialsFabrics() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::Fabrics::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFabricsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.Fabrics response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SupportedFabrics */ class ReadOperationalCredentialsSupportedFabrics : public ReadAttribute { public: ReadOperationalCredentialsSupportedFabrics() : ReadAttribute("supported-fabrics") { } ~ReadOperationalCredentialsSupportedFabrics() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::SupportedFabrics::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedFabricsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.SupportedFabrics response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalCredentials SupportedFabrics read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalCredentialsSupportedFabrics : public SubscribeAttribute { public: SubscribeAttributeOperationalCredentialsSupportedFabrics() : SubscribeAttribute("supported-fabrics") { } ~SubscribeAttributeOperationalCredentialsSupportedFabrics() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::SupportedFabrics::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedFabricsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.SupportedFabrics response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CommissionedFabrics */ class ReadOperationalCredentialsCommissionedFabrics : public ReadAttribute { public: ReadOperationalCredentialsCommissionedFabrics() : ReadAttribute("commissioned-fabrics") { } ~ReadOperationalCredentialsCommissionedFabrics() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::CommissionedFabrics::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCommissionedFabricsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.CommissionedFabrics response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalCredentials CommissionedFabrics read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalCredentialsCommissionedFabrics : public SubscribeAttribute { public: SubscribeAttributeOperationalCredentialsCommissionedFabrics() : SubscribeAttribute("commissioned-fabrics") { } ~SubscribeAttributeOperationalCredentialsCommissionedFabrics() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::CommissionedFabrics::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCommissionedFabricsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.CommissionedFabrics response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TrustedRootCertificates */ class ReadOperationalCredentialsTrustedRootCertificates : public ReadAttribute { public: ReadOperationalCredentialsTrustedRootCertificates() : ReadAttribute("trusted-root-certificates") { } ~ReadOperationalCredentialsTrustedRootCertificates() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::TrustedRootCertificates::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTrustedRootCertificatesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.TrustedRootCertificates response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalCredentials TrustedRootCertificates read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalCredentialsTrustedRootCertificates : public SubscribeAttribute { public: SubscribeAttributeOperationalCredentialsTrustedRootCertificates() : SubscribeAttribute("trusted-root-certificates") { } ~SubscribeAttributeOperationalCredentialsTrustedRootCertificates() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::TrustedRootCertificates::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTrustedRootCertificatesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.TrustedRootCertificates response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentFabricIndex */ class ReadOperationalCredentialsCurrentFabricIndex : public ReadAttribute { public: ReadOperationalCredentialsCurrentFabricIndex() : ReadAttribute("current-fabric-index") { } ~ReadOperationalCredentialsCurrentFabricIndex() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::CurrentFabricIndex::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentFabricIndexWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.CurrentFabricIndex response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalCredentials CurrentFabricIndex read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalCredentialsCurrentFabricIndex : public SubscribeAttribute { public: SubscribeAttributeOperationalCredentialsCurrentFabricIndex() : SubscribeAttribute("current-fabric-index") { } ~SubscribeAttributeOperationalCredentialsCurrentFabricIndex() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::CurrentFabricIndex::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentFabricIndexWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.CurrentFabricIndex response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadOperationalCredentialsGeneratedCommandList : public ReadAttribute { public: ReadOperationalCredentialsGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadOperationalCredentialsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalCredentials GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalCredentialsGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeOperationalCredentialsGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeOperationalCredentialsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadOperationalCredentialsAcceptedCommandList : public ReadAttribute { public: ReadOperationalCredentialsAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadOperationalCredentialsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalCredentials AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalCredentialsAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeOperationalCredentialsAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeOperationalCredentialsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadOperationalCredentialsEventList : public ReadAttribute { public: ReadOperationalCredentialsEventList() : ReadAttribute("event-list") { } ~ReadOperationalCredentialsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalCredentials EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalCredentialsEventList : public SubscribeAttribute { public: SubscribeAttributeOperationalCredentialsEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeOperationalCredentialsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadOperationalCredentialsAttributeList : public ReadAttribute { public: ReadOperationalCredentialsAttributeList() : ReadAttribute("attribute-list") { } ~ReadOperationalCredentialsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalCredentials AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalCredentialsAttributeList : public SubscribeAttribute { public: SubscribeAttributeOperationalCredentialsAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeOperationalCredentialsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadOperationalCredentialsFeatureMap : public ReadAttribute { public: ReadOperationalCredentialsFeatureMap() : ReadAttribute("feature-map") { } ~ReadOperationalCredentialsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalCredentials FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalCredentialsFeatureMap : public SubscribeAttribute { public: SubscribeAttributeOperationalCredentialsFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeOperationalCredentialsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadOperationalCredentialsClusterRevision : public ReadAttribute { public: ReadOperationalCredentialsClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadOperationalCredentialsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalCredentials ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalCredentialsClusterRevision : public SubscribeAttribute { public: SubscribeAttributeOperationalCredentialsClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeOperationalCredentialsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalCredentials::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalCredentials::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster GroupKeyManagement | 0x003F | |------------------------------------------------------------------------------| | Commands: | | | * KeySetWrite | 0x00 | | * KeySetRead | 0x01 | | * KeySetRemove | 0x03 | | * KeySetReadAllIndices | 0x04 | |------------------------------------------------------------------------------| | Attributes: | | | * GroupKeyMap | 0x0000 | | * GroupTable | 0x0001 | | * MaxGroupsPerFabric | 0x0002 | | * MaxGroupKeysPerFabric | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command KeySetWrite */ class GroupKeyManagementKeySetWrite : public ClusterCommand { public: GroupKeyManagementKeySetWrite() : ClusterCommand("key-set-write") , mComplex_GroupKeySet(&mRequest.groupKeySet) { AddArgument("GroupKeySet", &mComplex_GroupKeySet); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGroupKeyManagementClusterKeySetWriteParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.groupKeySet = [MTRGroupKeyManagementClusterGroupKeySetStruct new]; params.groupKeySet.groupKeySetID = [NSNumber numberWithUnsignedShort:mRequest.groupKeySet.groupKeySetID]; params.groupKeySet.groupKeySecurityPolicy = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.groupKeySet.groupKeySecurityPolicy)]; if (mRequest.groupKeySet.epochKey0.IsNull()) { params.groupKeySet.epochKey0 = nil; } else { params.groupKeySet.epochKey0 = [NSData dataWithBytes:mRequest.groupKeySet.epochKey0.Value().data() length:mRequest.groupKeySet.epochKey0.Value().size()]; } if (mRequest.groupKeySet.epochStartTime0.IsNull()) { params.groupKeySet.epochStartTime0 = nil; } else { params.groupKeySet.epochStartTime0 = [NSNumber numberWithUnsignedLongLong:mRequest.groupKeySet.epochStartTime0.Value()]; } if (mRequest.groupKeySet.epochKey1.IsNull()) { params.groupKeySet.epochKey1 = nil; } else { params.groupKeySet.epochKey1 = [NSData dataWithBytes:mRequest.groupKeySet.epochKey1.Value().data() length:mRequest.groupKeySet.epochKey1.Value().size()]; } if (mRequest.groupKeySet.epochStartTime1.IsNull()) { params.groupKeySet.epochStartTime1 = nil; } else { params.groupKeySet.epochStartTime1 = [NSNumber numberWithUnsignedLongLong:mRequest.groupKeySet.epochStartTime1.Value()]; } if (mRequest.groupKeySet.epochKey2.IsNull()) { params.groupKeySet.epochKey2 = nil; } else { params.groupKeySet.epochKey2 = [NSData dataWithBytes:mRequest.groupKeySet.epochKey2.Value().data() length:mRequest.groupKeySet.epochKey2.Value().size()]; } if (mRequest.groupKeySet.epochStartTime2.IsNull()) { params.groupKeySet.epochStartTime2 = nil; } else { params.groupKeySet.epochStartTime2 = [NSNumber numberWithUnsignedLongLong:mRequest.groupKeySet.epochStartTime2.Value()]; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster keySetWriteWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::GroupKeyManagement::Commands::KeySetWrite::Type mRequest; TypedComplexArgument mComplex_GroupKeySet; }; /* * Command KeySetRead */ class GroupKeyManagementKeySetRead : public ClusterCommand { public: GroupKeyManagementKeySetRead() : ClusterCommand("key-set-read") { AddArgument("GroupKeySetID", 0, UINT16_MAX, &mRequest.groupKeySetID); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGroupKeyManagementClusterKeySetReadParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.groupKeySetID = [NSNumber numberWithUnsignedShort:mRequest.groupKeySetID]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster keySetReadWithParams:params completion: ^(MTRGroupKeyManagementClusterKeySetReadResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type mRequest; }; /* * Command KeySetRemove */ class GroupKeyManagementKeySetRemove : public ClusterCommand { public: GroupKeyManagementKeySetRemove() : ClusterCommand("key-set-remove") { AddArgument("GroupKeySetID", 0, UINT16_MAX, &mRequest.groupKeySetID); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGroupKeyManagementClusterKeySetRemoveParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.groupKeySetID = [NSNumber numberWithUnsignedShort:mRequest.groupKeySetID]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster keySetRemoveWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::GroupKeyManagement::Commands::KeySetRemove::Type mRequest; }; /* * Command KeySetReadAllIndices */ class GroupKeyManagementKeySetReadAllIndices : public ClusterCommand { public: GroupKeyManagementKeySetReadAllIndices() : ClusterCommand("key-set-read-all-indices") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndices::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRGroupKeyManagementClusterKeySetReadAllIndicesParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster keySetReadAllIndicesWithParams:params completion: ^(MTRGroupKeyManagementClusterKeySetReadAllIndicesResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndicesResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::GroupKeyManagement::Commands::KeySetReadAllIndicesResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Attribute GroupKeyMap */ class ReadGroupKeyManagementGroupKeyMap : public ReadAttribute { public: ReadGroupKeyManagementGroupKeyMap() : ReadAttribute("group-key-map") { } ~ReadGroupKeyManagementGroupKeyMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::GroupKeyMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRReadParams alloc] init]; if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } [cluster readAttributeGroupKeyMapWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.GroupKeyMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GroupKeyManagement GroupKeyMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteGroupKeyManagementGroupKeyMap : public WriteAttribute { public: WriteGroupKeyManagementGroupKeyMap() : WriteAttribute("group-key-map") , mComplex(&mValue) { AddArgument("attr-name", "group-key-map"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteGroupKeyManagementGroupKeyMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::GroupKeyMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSArray * _Nonnull value; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { MTRGroupKeyManagementClusterGroupKeyMapStruct * newElement_0; newElement_0 = [MTRGroupKeyManagementClusterGroupKeyMapStruct new]; newElement_0.groupId = [NSNumber numberWithUnsignedShort:entry_0.groupId]; newElement_0.groupKeySetID = [NSNumber numberWithUnsignedShort:entry_0.groupKeySetID]; newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } value = array_0; } [cluster writeAttributeGroupKeyMapWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("GroupKeyManagement GroupKeyMap write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::List mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeGroupKeyManagementGroupKeyMap : public SubscribeAttribute { public: SubscribeAttributeGroupKeyManagementGroupKeyMap() : SubscribeAttribute("group-key-map") { } ~SubscribeAttributeGroupKeyManagementGroupKeyMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::GroupKeyMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGroupKeyMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.GroupKeyMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GroupTable */ class ReadGroupKeyManagementGroupTable : public ReadAttribute { public: ReadGroupKeyManagementGroupTable() : ReadAttribute("group-table") { } ~ReadGroupKeyManagementGroupTable() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::GroupTable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRReadParams alloc] init]; if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } [cluster readAttributeGroupTableWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.GroupTable response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GroupKeyManagement GroupTable read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGroupKeyManagementGroupTable : public SubscribeAttribute { public: SubscribeAttributeGroupKeyManagementGroupTable() : SubscribeAttribute("group-table") { } ~SubscribeAttributeGroupKeyManagementGroupTable() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::GroupTable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGroupTableWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.GroupTable response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxGroupsPerFabric */ class ReadGroupKeyManagementMaxGroupsPerFabric : public ReadAttribute { public: ReadGroupKeyManagementMaxGroupsPerFabric() : ReadAttribute("max-groups-per-fabric") { } ~ReadGroupKeyManagementMaxGroupsPerFabric() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::MaxGroupsPerFabric::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxGroupsPerFabricWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.MaxGroupsPerFabric response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GroupKeyManagement MaxGroupsPerFabric read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGroupKeyManagementMaxGroupsPerFabric : public SubscribeAttribute { public: SubscribeAttributeGroupKeyManagementMaxGroupsPerFabric() : SubscribeAttribute("max-groups-per-fabric") { } ~SubscribeAttributeGroupKeyManagementMaxGroupsPerFabric() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::MaxGroupsPerFabric::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxGroupsPerFabricWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.MaxGroupsPerFabric response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxGroupKeysPerFabric */ class ReadGroupKeyManagementMaxGroupKeysPerFabric : public ReadAttribute { public: ReadGroupKeyManagementMaxGroupKeysPerFabric() : ReadAttribute("max-group-keys-per-fabric") { } ~ReadGroupKeyManagementMaxGroupKeysPerFabric() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::MaxGroupKeysPerFabric::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxGroupKeysPerFabricWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.MaxGroupKeysPerFabric response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GroupKeyManagement MaxGroupKeysPerFabric read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGroupKeyManagementMaxGroupKeysPerFabric : public SubscribeAttribute { public: SubscribeAttributeGroupKeyManagementMaxGroupKeysPerFabric() : SubscribeAttribute("max-group-keys-per-fabric") { } ~SubscribeAttributeGroupKeyManagementMaxGroupKeysPerFabric() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::MaxGroupKeysPerFabric::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxGroupKeysPerFabricWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.MaxGroupKeysPerFabric response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadGroupKeyManagementGeneratedCommandList : public ReadAttribute { public: ReadGroupKeyManagementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadGroupKeyManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GroupKeyManagement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGroupKeyManagementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeGroupKeyManagementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeGroupKeyManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadGroupKeyManagementAcceptedCommandList : public ReadAttribute { public: ReadGroupKeyManagementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadGroupKeyManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GroupKeyManagement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGroupKeyManagementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeGroupKeyManagementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeGroupKeyManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadGroupKeyManagementEventList : public ReadAttribute { public: ReadGroupKeyManagementEventList() : ReadAttribute("event-list") { } ~ReadGroupKeyManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GroupKeyManagement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGroupKeyManagementEventList : public SubscribeAttribute { public: SubscribeAttributeGroupKeyManagementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeGroupKeyManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadGroupKeyManagementAttributeList : public ReadAttribute { public: ReadGroupKeyManagementAttributeList() : ReadAttribute("attribute-list") { } ~ReadGroupKeyManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GroupKeyManagement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGroupKeyManagementAttributeList : public SubscribeAttribute { public: SubscribeAttributeGroupKeyManagementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeGroupKeyManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadGroupKeyManagementFeatureMap : public ReadAttribute { public: ReadGroupKeyManagementFeatureMap() : ReadAttribute("feature-map") { } ~ReadGroupKeyManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GroupKeyManagement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGroupKeyManagementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeGroupKeyManagementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeGroupKeyManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadGroupKeyManagementClusterRevision : public ReadAttribute { public: ReadGroupKeyManagementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadGroupKeyManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("GroupKeyManagement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeGroupKeyManagementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeGroupKeyManagementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeGroupKeyManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::GroupKeyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::GroupKeyManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster FixedLabel | 0x0040 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * LabelList | 0x0000 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute LabelList */ class ReadFixedLabelLabelList : public ReadAttribute { public: ReadFixedLabelLabelList() : ReadAttribute("label-list") { } ~ReadFixedLabelLabelList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FixedLabel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FixedLabel::Attributes::LabelList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLabelListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.LabelList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FixedLabel LabelList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFixedLabelLabelList : public SubscribeAttribute { public: SubscribeAttributeFixedLabelLabelList() : SubscribeAttribute("label-list") { } ~SubscribeAttributeFixedLabelLabelList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FixedLabel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FixedLabel::Attributes::LabelList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLabelListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.LabelList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadFixedLabelGeneratedCommandList : public ReadAttribute { public: ReadFixedLabelGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadFixedLabelGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FixedLabel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FixedLabel::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FixedLabel GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFixedLabelGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeFixedLabelGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeFixedLabelGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FixedLabel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FixedLabel::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadFixedLabelAcceptedCommandList : public ReadAttribute { public: ReadFixedLabelAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadFixedLabelAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FixedLabel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FixedLabel::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FixedLabel AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFixedLabelAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeFixedLabelAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeFixedLabelAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FixedLabel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FixedLabel::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadFixedLabelEventList : public ReadAttribute { public: ReadFixedLabelEventList() : ReadAttribute("event-list") { } ~ReadFixedLabelEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FixedLabel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FixedLabel::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FixedLabel EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFixedLabelEventList : public SubscribeAttribute { public: SubscribeAttributeFixedLabelEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeFixedLabelEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FixedLabel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FixedLabel::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadFixedLabelAttributeList : public ReadAttribute { public: ReadFixedLabelAttributeList() : ReadAttribute("attribute-list") { } ~ReadFixedLabelAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FixedLabel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FixedLabel::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FixedLabel AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFixedLabelAttributeList : public SubscribeAttribute { public: SubscribeAttributeFixedLabelAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeFixedLabelAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FixedLabel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FixedLabel::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadFixedLabelFeatureMap : public ReadAttribute { public: ReadFixedLabelFeatureMap() : ReadAttribute("feature-map") { } ~ReadFixedLabelFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FixedLabel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FixedLabel::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FixedLabel FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFixedLabelFeatureMap : public SubscribeAttribute { public: SubscribeAttributeFixedLabelFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeFixedLabelFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FixedLabel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FixedLabel::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadFixedLabelClusterRevision : public ReadAttribute { public: ReadFixedLabelClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadFixedLabelClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FixedLabel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FixedLabel::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FixedLabel ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFixedLabelClusterRevision : public SubscribeAttribute { public: SubscribeAttributeFixedLabelClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeFixedLabelClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FixedLabel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FixedLabel::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFixedLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster UserLabel | 0x0041 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * LabelList | 0x0000 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute LabelList */ class ReadUserLabelLabelList : public ReadAttribute { public: ReadUserLabelLabelList() : ReadAttribute("label-list") { } ~ReadUserLabelLabelList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UserLabel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UserLabel::Attributes::LabelList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLabelListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.LabelList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UserLabel LabelList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUserLabelLabelList : public WriteAttribute { public: WriteUserLabelLabelList() : WriteAttribute("label-list") , mComplex(&mValue) { AddArgument("attr-name", "label-list"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteUserLabelLabelList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UserLabel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UserLabel::Attributes::LabelList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSArray * _Nonnull value; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { MTRUserLabelClusterLabelStruct * newElement_0; newElement_0 = [MTRUserLabelClusterLabelStruct new]; newElement_0.label = [[NSString alloc] initWithBytes:entry_0.label.data() length:entry_0.label.size() encoding:NSUTF8StringEncoding]; newElement_0.value = [[NSString alloc] initWithBytes:entry_0.value.data() length:entry_0.value.size() encoding:NSUTF8StringEncoding]; [array_0 addObject:newElement_0]; } value = array_0; } [cluster writeAttributeLabelListWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UserLabel LabelList write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::List mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeUserLabelLabelList : public SubscribeAttribute { public: SubscribeAttributeUserLabelLabelList() : SubscribeAttribute("label-list") { } ~SubscribeAttributeUserLabelLabelList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UserLabel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UserLabel::Attributes::LabelList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLabelListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.LabelList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadUserLabelGeneratedCommandList : public ReadAttribute { public: ReadUserLabelGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadUserLabelGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UserLabel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UserLabel::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UserLabel GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUserLabelGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeUserLabelGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeUserLabelGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UserLabel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UserLabel::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadUserLabelAcceptedCommandList : public ReadAttribute { public: ReadUserLabelAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadUserLabelAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UserLabel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UserLabel::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UserLabel AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUserLabelAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeUserLabelAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeUserLabelAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UserLabel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UserLabel::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadUserLabelEventList : public ReadAttribute { public: ReadUserLabelEventList() : ReadAttribute("event-list") { } ~ReadUserLabelEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UserLabel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UserLabel::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UserLabel EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUserLabelEventList : public SubscribeAttribute { public: SubscribeAttributeUserLabelEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeUserLabelEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UserLabel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UserLabel::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadUserLabelAttributeList : public ReadAttribute { public: ReadUserLabelAttributeList() : ReadAttribute("attribute-list") { } ~ReadUserLabelAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UserLabel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UserLabel::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UserLabel AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUserLabelAttributeList : public SubscribeAttribute { public: SubscribeAttributeUserLabelAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeUserLabelAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UserLabel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UserLabel::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadUserLabelFeatureMap : public ReadAttribute { public: ReadUserLabelFeatureMap() : ReadAttribute("feature-map") { } ~ReadUserLabelFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UserLabel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UserLabel::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UserLabel FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUserLabelFeatureMap : public SubscribeAttribute { public: SubscribeAttributeUserLabelFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeUserLabelFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UserLabel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UserLabel::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadUserLabelClusterRevision : public ReadAttribute { public: ReadUserLabelClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadUserLabelClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UserLabel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UserLabel::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UserLabel ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUserLabelClusterRevision : public SubscribeAttribute { public: SubscribeAttributeUserLabelClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeUserLabelClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UserLabel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UserLabel::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUserLabel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster BooleanState | 0x0045 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * StateValue | 0x0000 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * StateChange | 0x0000 | \*----------------------------------------------------------------------------*/ /* * Attribute StateValue */ class ReadBooleanStateStateValue : public ReadAttribute { public: ReadBooleanStateStateValue() : ReadAttribute("state-value") { } ~ReadBooleanStateStateValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanState::Attributes::StateValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStateValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.StateValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanState StateValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateStateValue : public SubscribeAttribute { public: SubscribeAttributeBooleanStateStateValue() : SubscribeAttribute("state-value") { } ~SubscribeAttributeBooleanStateStateValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanState::Attributes::StateValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStateValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.StateValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadBooleanStateGeneratedCommandList : public ReadAttribute { public: ReadBooleanStateGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadBooleanStateGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanState::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanState GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeBooleanStateGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeBooleanStateGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanState::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadBooleanStateAcceptedCommandList : public ReadAttribute { public: ReadBooleanStateAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadBooleanStateAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanState::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanState AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeBooleanStateAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeBooleanStateAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanState::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadBooleanStateEventList : public ReadAttribute { public: ReadBooleanStateEventList() : ReadAttribute("event-list") { } ~ReadBooleanStateEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanState::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanState EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateEventList : public SubscribeAttribute { public: SubscribeAttributeBooleanStateEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeBooleanStateEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanState::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadBooleanStateAttributeList : public ReadAttribute { public: ReadBooleanStateAttributeList() : ReadAttribute("attribute-list") { } ~ReadBooleanStateAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanState::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanState AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateAttributeList : public SubscribeAttribute { public: SubscribeAttributeBooleanStateAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeBooleanStateAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanState::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadBooleanStateFeatureMap : public ReadAttribute { public: ReadBooleanStateFeatureMap() : ReadAttribute("feature-map") { } ~ReadBooleanStateFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanState::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanState FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateFeatureMap : public SubscribeAttribute { public: SubscribeAttributeBooleanStateFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeBooleanStateFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanState::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadBooleanStateClusterRevision : public ReadAttribute { public: ReadBooleanStateClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadBooleanStateClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanState::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanState ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateClusterRevision : public SubscribeAttribute { public: SubscribeAttributeBooleanStateClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeBooleanStateClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanState::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster IcdManagement | 0x0046 | |------------------------------------------------------------------------------| | Commands: | | | * RegisterClient | 0x00 | | * UnregisterClient | 0x02 | | * StayActiveRequest | 0x03 | |------------------------------------------------------------------------------| | Attributes: | | | * IdleModeDuration | 0x0000 | | * ActiveModeDuration | 0x0001 | | * ActiveModeThreshold | 0x0002 | | * RegisteredClients | 0x0003 | | * ICDCounter | 0x0004 | | * ClientsSupportedPerFabric | 0x0005 | | * UserActiveModeTriggerHint | 0x0006 | | * UserActiveModeTriggerInstruction | 0x0007 | | * OperatingMode | 0x0008 | | * MaximumCheckInBackOff | 0x0009 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command RegisterClient */ class IcdManagementRegisterClient : public ClusterCommand { public: IcdManagementRegisterClient() : ClusterCommand("register-client") { #if MTR_ENABLE_PROVISIONAL AddArgument("CheckInNodeID", 0, UINT64_MAX, &mRequest.checkInNodeID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MonitoredSubject", 0, UINT64_MAX, &mRequest.monitoredSubject); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Key", &mRequest.key); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("VerificationKey", &mRequest.verificationKey); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ClientType", 0, UINT8_MAX, &mRequest.clientType); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::IcdManagement::Commands::RegisterClient::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRICDManagementClusterRegisterClientParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.checkInNodeID = [NSNumber numberWithUnsignedLongLong:mRequest.checkInNodeID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.monitoredSubject = [NSNumber numberWithUnsignedLongLong:mRequest.monitoredSubject]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.key = [NSData dataWithBytes:mRequest.key.data() length:mRequest.key.size()]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.verificationKey.HasValue()) { params.verificationKey = [NSData dataWithBytes:mRequest.verificationKey.Value().data() length:mRequest.verificationKey.Value().size()]; } else { params.verificationKey = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.clientType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.clientType)]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster registerClientWithParams:params completion: ^(MTRICDManagementClusterRegisterClientResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::IcdManagement::Commands::RegisterClient::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command UnregisterClient */ class IcdManagementUnregisterClient : public ClusterCommand { public: IcdManagementUnregisterClient() : ClusterCommand("unregister-client") { #if MTR_ENABLE_PROVISIONAL AddArgument("CheckInNodeID", 0, UINT64_MAX, &mRequest.checkInNodeID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("VerificationKey", &mRequest.verificationKey); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRICDManagementClusterUnregisterClientParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.checkInNodeID = [NSNumber numberWithUnsignedLongLong:mRequest.checkInNodeID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.verificationKey.HasValue()) { params.verificationKey = [NSData dataWithBytes:mRequest.verificationKey.Value().data() length:mRequest.verificationKey.Value().size()]; } else { params.verificationKey = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster unregisterClientWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command StayActiveRequest */ class IcdManagementStayActiveRequest : public ClusterCommand { public: IcdManagementStayActiveRequest() : ClusterCommand("stay-active-request") { #if MTR_ENABLE_PROVISIONAL AddArgument("StayActiveDuration", 0, UINT32_MAX, &mRequest.stayActiveDuration); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::IcdManagement::Commands::StayActiveRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRICDManagementClusterStayActiveRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.stayActiveDuration = [NSNumber numberWithUnsignedInt:mRequest.stayActiveDuration]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stayActiveRequestWithParams:params completion: ^(MTRICDManagementClusterStayActiveResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::IcdManagement::Commands::StayActiveResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::IcdManagement::Commands::StayActiveResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::IcdManagement::Commands::StayActiveRequest::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute IdleModeDuration */ class ReadIcdManagementIdleModeDuration : public ReadAttribute { public: ReadIcdManagementIdleModeDuration() : ReadAttribute("idle-mode-duration") { } ~ReadIcdManagementIdleModeDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::IdleModeDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeIdleModeDurationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.IdleModeDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ICDManagement IdleModeDuration read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIcdManagementIdleModeDuration : public SubscribeAttribute { public: SubscribeAttributeIcdManagementIdleModeDuration() : SubscribeAttribute("idle-mode-duration") { } ~SubscribeAttributeIcdManagementIdleModeDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::IdleModeDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeIdleModeDurationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.IdleModeDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ActiveModeDuration */ class ReadIcdManagementActiveModeDuration : public ReadAttribute { public: ReadIcdManagementActiveModeDuration() : ReadAttribute("active-mode-duration") { } ~ReadIcdManagementActiveModeDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::ActiveModeDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveModeDurationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.ActiveModeDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ICDManagement ActiveModeDuration read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIcdManagementActiveModeDuration : public SubscribeAttribute { public: SubscribeAttributeIcdManagementActiveModeDuration() : SubscribeAttribute("active-mode-duration") { } ~SubscribeAttributeIcdManagementActiveModeDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::ActiveModeDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveModeDurationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.ActiveModeDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ActiveModeThreshold */ class ReadIcdManagementActiveModeThreshold : public ReadAttribute { public: ReadIcdManagementActiveModeThreshold() : ReadAttribute("active-mode-threshold") { } ~ReadIcdManagementActiveModeThreshold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::ActiveModeThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveModeThresholdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.ActiveModeThreshold response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ICDManagement ActiveModeThreshold read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIcdManagementActiveModeThreshold : public SubscribeAttribute { public: SubscribeAttributeIcdManagementActiveModeThreshold() : SubscribeAttribute("active-mode-threshold") { } ~SubscribeAttributeIcdManagementActiveModeThreshold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::ActiveModeThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveModeThresholdWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.ActiveModeThreshold response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute RegisteredClients */ class ReadIcdManagementRegisteredClients : public ReadAttribute { public: ReadIcdManagementRegisteredClients() : ReadAttribute("registered-clients") { } ~ReadIcdManagementRegisteredClients() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::RegisteredClients::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRReadParams alloc] init]; if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } [cluster readAttributeRegisteredClientsWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.RegisteredClients response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ICDManagement RegisteredClients read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIcdManagementRegisteredClients : public SubscribeAttribute { public: SubscribeAttributeIcdManagementRegisteredClients() : SubscribeAttribute("registered-clients") { } ~SubscribeAttributeIcdManagementRegisteredClients() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::RegisteredClients::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRegisteredClientsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.RegisteredClients response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ICDCounter */ class ReadIcdManagementICDCounter : public ReadAttribute { public: ReadIcdManagementICDCounter() : ReadAttribute("icdcounter") { } ~ReadIcdManagementICDCounter() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::ICDCounter::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeICDCounterWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.ICDCounter response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ICDManagement ICDCounter read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIcdManagementICDCounter : public SubscribeAttribute { public: SubscribeAttributeIcdManagementICDCounter() : SubscribeAttribute("icdcounter") { } ~SubscribeAttributeIcdManagementICDCounter() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::ICDCounter::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeICDCounterWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.ICDCounter response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClientsSupportedPerFabric */ class ReadIcdManagementClientsSupportedPerFabric : public ReadAttribute { public: ReadIcdManagementClientsSupportedPerFabric() : ReadAttribute("clients-supported-per-fabric") { } ~ReadIcdManagementClientsSupportedPerFabric() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::ClientsSupportedPerFabric::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClientsSupportedPerFabricWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.ClientsSupportedPerFabric response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ICDManagement ClientsSupportedPerFabric read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIcdManagementClientsSupportedPerFabric : public SubscribeAttribute { public: SubscribeAttributeIcdManagementClientsSupportedPerFabric() : SubscribeAttribute("clients-supported-per-fabric") { } ~SubscribeAttributeIcdManagementClientsSupportedPerFabric() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::ClientsSupportedPerFabric::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClientsSupportedPerFabricWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.ClientsSupportedPerFabric response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute UserActiveModeTriggerHint */ class ReadIcdManagementUserActiveModeTriggerHint : public ReadAttribute { public: ReadIcdManagementUserActiveModeTriggerHint() : ReadAttribute("user-active-mode-trigger-hint") { } ~ReadIcdManagementUserActiveModeTriggerHint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::UserActiveModeTriggerHint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUserActiveModeTriggerHintWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.UserActiveModeTriggerHint response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ICDManagement UserActiveModeTriggerHint read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIcdManagementUserActiveModeTriggerHint : public SubscribeAttribute { public: SubscribeAttributeIcdManagementUserActiveModeTriggerHint() : SubscribeAttribute("user-active-mode-trigger-hint") { } ~SubscribeAttributeIcdManagementUserActiveModeTriggerHint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::UserActiveModeTriggerHint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUserActiveModeTriggerHintWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.UserActiveModeTriggerHint response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute UserActiveModeTriggerInstruction */ class ReadIcdManagementUserActiveModeTriggerInstruction : public ReadAttribute { public: ReadIcdManagementUserActiveModeTriggerInstruction() : ReadAttribute("user-active-mode-trigger-instruction") { } ~ReadIcdManagementUserActiveModeTriggerInstruction() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::UserActiveModeTriggerInstruction::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUserActiveModeTriggerInstructionWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.UserActiveModeTriggerInstruction response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ICDManagement UserActiveModeTriggerInstruction read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIcdManagementUserActiveModeTriggerInstruction : public SubscribeAttribute { public: SubscribeAttributeIcdManagementUserActiveModeTriggerInstruction() : SubscribeAttribute("user-active-mode-trigger-instruction") { } ~SubscribeAttributeIcdManagementUserActiveModeTriggerInstruction() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::UserActiveModeTriggerInstruction::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUserActiveModeTriggerInstructionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.UserActiveModeTriggerInstruction response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute OperatingMode */ class ReadIcdManagementOperatingMode : public ReadAttribute { public: ReadIcdManagementOperatingMode() : ReadAttribute("operating-mode") { } ~ReadIcdManagementOperatingMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::OperatingMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOperatingModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.OperatingMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ICDManagement OperatingMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIcdManagementOperatingMode : public SubscribeAttribute { public: SubscribeAttributeIcdManagementOperatingMode() : SubscribeAttribute("operating-mode") { } ~SubscribeAttributeIcdManagementOperatingMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::OperatingMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOperatingModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.OperatingMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MaximumCheckInBackOff */ class ReadIcdManagementMaximumCheckInBackOff : public ReadAttribute { public: ReadIcdManagementMaximumCheckInBackOff() : ReadAttribute("maximum-check-in-back-off") { } ~ReadIcdManagementMaximumCheckInBackOff() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::MaximumCheckInBackOff::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaximumCheckInBackOffWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.MaximumCheckInBackOff response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ICDManagement MaximumCheckInBackOff read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIcdManagementMaximumCheckInBackOff : public SubscribeAttribute { public: SubscribeAttributeIcdManagementMaximumCheckInBackOff() : SubscribeAttribute("maximum-check-in-back-off") { } ~SubscribeAttributeIcdManagementMaximumCheckInBackOff() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::MaximumCheckInBackOff::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaximumCheckInBackOffWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.MaximumCheckInBackOff response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadIcdManagementGeneratedCommandList : public ReadAttribute { public: ReadIcdManagementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadIcdManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ICDManagement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIcdManagementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeIcdManagementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeIcdManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadIcdManagementAcceptedCommandList : public ReadAttribute { public: ReadIcdManagementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadIcdManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ICDManagement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIcdManagementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeIcdManagementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeIcdManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadIcdManagementEventList : public ReadAttribute { public: ReadIcdManagementEventList() : ReadAttribute("event-list") { } ~ReadIcdManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ICDManagement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIcdManagementEventList : public SubscribeAttribute { public: SubscribeAttributeIcdManagementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeIcdManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadIcdManagementAttributeList : public ReadAttribute { public: ReadIcdManagementAttributeList() : ReadAttribute("attribute-list") { } ~ReadIcdManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ICDManagement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIcdManagementAttributeList : public SubscribeAttribute { public: SubscribeAttributeIcdManagementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeIcdManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadIcdManagementFeatureMap : public ReadAttribute { public: ReadIcdManagementFeatureMap() : ReadAttribute("feature-map") { } ~ReadIcdManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ICDManagement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIcdManagementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeIcdManagementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeIcdManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadIcdManagementClusterRevision : public ReadAttribute { public: ReadIcdManagementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadIcdManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IcdManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ICDManagement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIcdManagementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeIcdManagementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeIcdManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IcdManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IcdManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ICDManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster Timer | 0x0047 | |------------------------------------------------------------------------------| | Commands: | | | * SetTimer | 0x00 | | * ResetTimer | 0x01 | | * AddTime | 0x02 | | * ReduceTime | 0x03 | |------------------------------------------------------------------------------| | Attributes: | | | * SetTime | 0x0000 | | * TimeRemaining | 0x0001 | | * TimerState | 0x0002 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command SetTimer */ class TimerSetTimer : public ClusterCommand { public: TimerSetTimer() : ClusterCommand("set-timer") { #if MTR_ENABLE_PROVISIONAL AddArgument("NewTime", 0, UINT32_MAX, &mRequest.newTime); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Timer::Commands::SetTimer::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRTimerClusterSetTimerParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.newTime = [NSNumber numberWithUnsignedInt:mRequest.newTime]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setTimerWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Timer::Commands::SetTimer::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command ResetTimer */ class TimerResetTimer : public ClusterCommand { public: TimerResetTimer() : ClusterCommand("reset-timer") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Timer::Commands::ResetTimer::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRTimerClusterResetTimerParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster resetTimerWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command AddTime */ class TimerAddTime : public ClusterCommand { public: TimerAddTime() : ClusterCommand("add-time") { #if MTR_ENABLE_PROVISIONAL AddArgument("AdditionalTime", 0, UINT32_MAX, &mRequest.additionalTime); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Timer::Commands::AddTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRTimerClusterAddTimeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.additionalTime = [NSNumber numberWithUnsignedInt:mRequest.additionalTime]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster addTimeWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Timer::Commands::AddTime::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command ReduceTime */ class TimerReduceTime : public ClusterCommand { public: TimerReduceTime() : ClusterCommand("reduce-time") { #if MTR_ENABLE_PROVISIONAL AddArgument("TimeReduction", 0, UINT32_MAX, &mRequest.timeReduction); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Timer::Commands::ReduceTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRTimerClusterReduceTimeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.timeReduction = [NSNumber numberWithUnsignedInt:mRequest.timeReduction]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster reduceTimeWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Timer::Commands::ReduceTime::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SetTime */ class ReadTimerSetTime : public ReadAttribute { public: ReadTimerSetTime() : ReadAttribute("set-time") { } ~ReadTimerSetTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Timer::Attributes::SetTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSetTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.SetTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Timer SetTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimerSetTime : public SubscribeAttribute { public: SubscribeAttributeTimerSetTime() : SubscribeAttribute("set-time") { } ~SubscribeAttributeTimerSetTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Timer::Attributes::SetTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSetTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.SetTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute TimeRemaining */ class ReadTimerTimeRemaining : public ReadAttribute { public: ReadTimerTimeRemaining() : ReadAttribute("time-remaining") { } ~ReadTimerTimeRemaining() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Timer::Attributes::TimeRemaining::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTimeRemainingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.TimeRemaining response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Timer TimeRemaining read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimerTimeRemaining : public SubscribeAttribute { public: SubscribeAttributeTimerTimeRemaining() : SubscribeAttribute("time-remaining") { } ~SubscribeAttributeTimerTimeRemaining() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Timer::Attributes::TimeRemaining::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTimeRemainingWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.TimeRemaining response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute TimerState */ class ReadTimerTimerState : public ReadAttribute { public: ReadTimerTimerState() : ReadAttribute("timer-state") { } ~ReadTimerTimerState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Timer::Attributes::TimerState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTimerStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.TimerState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Timer TimerState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimerTimerState : public SubscribeAttribute { public: SubscribeAttributeTimerTimerState() : SubscribeAttribute("timer-state") { } ~SubscribeAttributeTimerTimerState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Timer::Attributes::TimerState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTimerStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.TimerState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadTimerGeneratedCommandList : public ReadAttribute { public: ReadTimerGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadTimerGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Timer::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Timer GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimerGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeTimerGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeTimerGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Timer::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadTimerAcceptedCommandList : public ReadAttribute { public: ReadTimerAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadTimerAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Timer::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Timer AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimerAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeTimerAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeTimerAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Timer::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadTimerEventList : public ReadAttribute { public: ReadTimerEventList() : ReadAttribute("event-list") { } ~ReadTimerEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Timer::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Timer EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimerEventList : public SubscribeAttribute { public: SubscribeAttributeTimerEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeTimerEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Timer::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadTimerAttributeList : public ReadAttribute { public: ReadTimerAttributeList() : ReadAttribute("attribute-list") { } ~ReadTimerAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Timer::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Timer AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimerAttributeList : public SubscribeAttribute { public: SubscribeAttributeTimerAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeTimerAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Timer::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadTimerFeatureMap : public ReadAttribute { public: ReadTimerFeatureMap() : ReadAttribute("feature-map") { } ~ReadTimerFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Timer::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Timer FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimerFeatureMap : public SubscribeAttribute { public: SubscribeAttributeTimerFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeTimerFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Timer::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadTimerClusterRevision : public ReadAttribute { public: ReadTimerClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadTimerClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Timer::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Timer ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTimerClusterRevision : public SubscribeAttribute { public: SubscribeAttributeTimerClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeTimerClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Timer::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Timer::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTimer alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Timer.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster OvenCavityOperationalState | 0x0048 | |------------------------------------------------------------------------------| | Commands: | | | * Pause | 0x00 | | * Stop | 0x01 | | * Start | 0x02 | | * Resume | 0x03 | |------------------------------------------------------------------------------| | Attributes: | | | * PhaseList | 0x0000 | | * CurrentPhase | 0x0001 | | * CountdownTime | 0x0002 | | * OperationalStateList | 0x0003 | | * OperationalState | 0x0004 | | * OperationalError | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * OperationalError | 0x0000 | | * OperationCompletion | 0x0001 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command Pause */ class OvenCavityOperationalStatePause : public ClusterCommand { public: OvenCavityOperationalStatePause() : ClusterCommand("pause") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OvenCavityOperationalState::Commands::Pause::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROvenCavityOperationalStateClusterPauseParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster pauseWithParams:params completion: ^(MTROvenCavityOperationalStateClusterOperationalCommandResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OvenCavityOperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OvenCavityOperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command Stop */ class OvenCavityOperationalStateStop : public ClusterCommand { public: OvenCavityOperationalStateStop() : ClusterCommand("stop") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OvenCavityOperationalState::Commands::Stop::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROvenCavityOperationalStateClusterStopParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stopWithParams:params completion: ^(MTROvenCavityOperationalStateClusterOperationalCommandResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OvenCavityOperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OvenCavityOperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command Start */ class OvenCavityOperationalStateStart : public ClusterCommand { public: OvenCavityOperationalStateStart() : ClusterCommand("start") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OvenCavityOperationalState::Commands::Start::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROvenCavityOperationalStateClusterStartParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster startWithParams:params completion: ^(MTROvenCavityOperationalStateClusterOperationalCommandResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OvenCavityOperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OvenCavityOperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command Resume */ class OvenCavityOperationalStateResume : public ClusterCommand { public: OvenCavityOperationalStateResume() : ClusterCommand("resume") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OvenCavityOperationalState::Commands::Resume::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROvenCavityOperationalStateClusterResumeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster resumeWithParams:params completion: ^(MTROvenCavityOperationalStateClusterOperationalCommandResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OvenCavityOperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OvenCavityOperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute PhaseList */ class ReadOvenCavityOperationalStatePhaseList : public ReadAttribute { public: ReadOvenCavityOperationalStatePhaseList() : ReadAttribute("phase-list") { } ~ReadOvenCavityOperationalStatePhaseList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::PhaseList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePhaseListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.PhaseList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenCavityOperationalState PhaseList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenCavityOperationalStatePhaseList : public SubscribeAttribute { public: SubscribeAttributeOvenCavityOperationalStatePhaseList() : SubscribeAttribute("phase-list") { } ~SubscribeAttributeOvenCavityOperationalStatePhaseList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::PhaseList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePhaseListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.PhaseList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentPhase */ class ReadOvenCavityOperationalStateCurrentPhase : public ReadAttribute { public: ReadOvenCavityOperationalStateCurrentPhase() : ReadAttribute("current-phase") { } ~ReadOvenCavityOperationalStateCurrentPhase() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::CurrentPhase::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentPhaseWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.CurrentPhase response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenCavityOperationalState CurrentPhase read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenCavityOperationalStateCurrentPhase : public SubscribeAttribute { public: SubscribeAttributeOvenCavityOperationalStateCurrentPhase() : SubscribeAttribute("current-phase") { } ~SubscribeAttributeOvenCavityOperationalStateCurrentPhase() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::CurrentPhase::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentPhaseWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.CurrentPhase response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CountdownTime */ class ReadOvenCavityOperationalStateCountdownTime : public ReadAttribute { public: ReadOvenCavityOperationalStateCountdownTime() : ReadAttribute("countdown-time") { } ~ReadOvenCavityOperationalStateCountdownTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::CountdownTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCountdownTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.CountdownTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenCavityOperationalState CountdownTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenCavityOperationalStateCountdownTime : public SubscribeAttribute { public: SubscribeAttributeOvenCavityOperationalStateCountdownTime() : SubscribeAttribute("countdown-time") { } ~SubscribeAttributeOvenCavityOperationalStateCountdownTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::CountdownTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCountdownTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.CountdownTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute OperationalStateList */ class ReadOvenCavityOperationalStateOperationalStateList : public ReadAttribute { public: ReadOvenCavityOperationalStateOperationalStateList() : ReadAttribute("operational-state-list") { } ~ReadOvenCavityOperationalStateOperationalStateList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::OperationalStateList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOperationalStateListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.OperationalStateList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenCavityOperationalState OperationalStateList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenCavityOperationalStateOperationalStateList : public SubscribeAttribute { public: SubscribeAttributeOvenCavityOperationalStateOperationalStateList() : SubscribeAttribute("operational-state-list") { } ~SubscribeAttributeOvenCavityOperationalStateOperationalStateList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::OperationalStateList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOperationalStateListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.OperationalStateList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute OperationalState */ class ReadOvenCavityOperationalStateOperationalState : public ReadAttribute { public: ReadOvenCavityOperationalStateOperationalState() : ReadAttribute("operational-state") { } ~ReadOvenCavityOperationalStateOperationalState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::OperationalState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOperationalStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.OperationalState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenCavityOperationalState OperationalState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenCavityOperationalStateOperationalState : public SubscribeAttribute { public: SubscribeAttributeOvenCavityOperationalStateOperationalState() : SubscribeAttribute("operational-state") { } ~SubscribeAttributeOvenCavityOperationalStateOperationalState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::OperationalState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOperationalStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.OperationalState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute OperationalError */ class ReadOvenCavityOperationalStateOperationalError : public ReadAttribute { public: ReadOvenCavityOperationalStateOperationalError() : ReadAttribute("operational-error") { } ~ReadOvenCavityOperationalStateOperationalError() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::OperationalError::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOperationalErrorWithCompletion:^(MTROvenCavityOperationalStateClusterErrorStateStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.OperationalError response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenCavityOperationalState OperationalError read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenCavityOperationalStateOperationalError : public SubscribeAttribute { public: SubscribeAttributeOvenCavityOperationalStateOperationalError() : SubscribeAttribute("operational-error") { } ~SubscribeAttributeOvenCavityOperationalStateOperationalError() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::OperationalError::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOperationalErrorWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTROvenCavityOperationalStateClusterErrorStateStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.OperationalError response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadOvenCavityOperationalStateGeneratedCommandList : public ReadAttribute { public: ReadOvenCavityOperationalStateGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadOvenCavityOperationalStateGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenCavityOperationalState GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenCavityOperationalStateGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeOvenCavityOperationalStateGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeOvenCavityOperationalStateGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadOvenCavityOperationalStateAcceptedCommandList : public ReadAttribute { public: ReadOvenCavityOperationalStateAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadOvenCavityOperationalStateAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenCavityOperationalState AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenCavityOperationalStateAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeOvenCavityOperationalStateAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeOvenCavityOperationalStateAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadOvenCavityOperationalStateEventList : public ReadAttribute { public: ReadOvenCavityOperationalStateEventList() : ReadAttribute("event-list") { } ~ReadOvenCavityOperationalStateEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenCavityOperationalState EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenCavityOperationalStateEventList : public SubscribeAttribute { public: SubscribeAttributeOvenCavityOperationalStateEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeOvenCavityOperationalStateEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadOvenCavityOperationalStateAttributeList : public ReadAttribute { public: ReadOvenCavityOperationalStateAttributeList() : ReadAttribute("attribute-list") { } ~ReadOvenCavityOperationalStateAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenCavityOperationalState AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenCavityOperationalStateAttributeList : public SubscribeAttribute { public: SubscribeAttributeOvenCavityOperationalStateAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeOvenCavityOperationalStateAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadOvenCavityOperationalStateFeatureMap : public ReadAttribute { public: ReadOvenCavityOperationalStateFeatureMap() : ReadAttribute("feature-map") { } ~ReadOvenCavityOperationalStateFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenCavityOperationalState FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenCavityOperationalStateFeatureMap : public SubscribeAttribute { public: SubscribeAttributeOvenCavityOperationalStateFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeOvenCavityOperationalStateFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadOvenCavityOperationalStateClusterRevision : public ReadAttribute { public: ReadOvenCavityOperationalStateClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadOvenCavityOperationalStateClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenCavityOperationalState ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenCavityOperationalStateClusterRevision : public SubscribeAttribute { public: SubscribeAttributeOvenCavityOperationalStateClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeOvenCavityOperationalStateClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenCavityOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenCavityOperationalState::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenCavityOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenCavityOperationalState.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster OvenMode | 0x0049 | |------------------------------------------------------------------------------| | Commands: | | | * ChangeToMode | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * SupportedModes | 0x0000 | | * CurrentMode | 0x0001 | | * StartUpMode | 0x0002 | | * OnMode | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command ChangeToMode */ class OvenModeChangeToMode : public ClusterCommand { public: OvenModeChangeToMode() : ClusterCommand("change-to-mode") { #if MTR_ENABLE_PROVISIONAL AddArgument("NewMode", 0, UINT8_MAX, &mRequest.newMode); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OvenMode::Commands::ChangeToMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROvenModeClusterChangeToModeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.newMode = [NSNumber numberWithUnsignedChar:mRequest.newMode]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster changeToModeWithParams:params completion: ^(MTROvenModeClusterChangeToModeResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OvenMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OvenMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::OvenMode::Commands::ChangeToMode::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedModes */ class ReadOvenModeSupportedModes : public ReadAttribute { public: ReadOvenModeSupportedModes() : ReadAttribute("supported-modes") { } ~ReadOvenModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedModesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenMode SupportedModes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenModeSupportedModes : public SubscribeAttribute { public: SubscribeAttributeOvenModeSupportedModes() : SubscribeAttribute("supported-modes") { } ~SubscribeAttributeOvenModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedModesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentMode */ class ReadOvenModeCurrentMode : public ReadAttribute { public: ReadOvenModeCurrentMode() : ReadAttribute("current-mode") { } ~ReadOvenModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenMode CurrentMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenModeCurrentMode : public SubscribeAttribute { public: SubscribeAttributeOvenModeCurrentMode() : SubscribeAttribute("current-mode") { } ~SubscribeAttributeOvenModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute StartUpMode */ class ReadOvenModeStartUpMode : public ReadAttribute { public: ReadOvenModeStartUpMode() : ReadAttribute("start-up-mode") { } ~ReadOvenModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStartUpModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.StartUpMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenMode StartUpMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteOvenModeStartUpMode : public WriteAttribute { public: WriteOvenModeStartUpMode() : WriteAttribute("start-up-mode") { AddArgument("attr-name", "start-up-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteOvenModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeStartUpModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("OvenMode StartUpMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeOvenModeStartUpMode : public SubscribeAttribute { public: SubscribeAttributeOvenModeStartUpMode() : SubscribeAttribute("start-up-mode") { } ~SubscribeAttributeOvenModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStartUpModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.StartUpMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute OnMode */ class ReadOvenModeOnMode : public ReadAttribute { public: ReadOvenModeOnMode() : ReadAttribute("on-mode") { } ~ReadOvenModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOnModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.OnMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenMode OnMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteOvenModeOnMode : public WriteAttribute { public: WriteOvenModeOnMode() : WriteAttribute("on-mode") { AddArgument("attr-name", "on-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteOvenModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeOnModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("OvenMode OnMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeOvenModeOnMode : public SubscribeAttribute { public: SubscribeAttributeOvenModeOnMode() : SubscribeAttribute("on-mode") { } ~SubscribeAttributeOvenModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOnModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.OnMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadOvenModeGeneratedCommandList : public ReadAttribute { public: ReadOvenModeGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadOvenModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenMode GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenModeGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeOvenModeGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeOvenModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadOvenModeAcceptedCommandList : public ReadAttribute { public: ReadOvenModeAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadOvenModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenMode AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenModeAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeOvenModeAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeOvenModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadOvenModeEventList : public ReadAttribute { public: ReadOvenModeEventList() : ReadAttribute("event-list") { } ~ReadOvenModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenMode EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenModeEventList : public SubscribeAttribute { public: SubscribeAttributeOvenModeEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeOvenModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadOvenModeAttributeList : public ReadAttribute { public: ReadOvenModeAttributeList() : ReadAttribute("attribute-list") { } ~ReadOvenModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenMode AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenModeAttributeList : public SubscribeAttribute { public: SubscribeAttributeOvenModeAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeOvenModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadOvenModeFeatureMap : public ReadAttribute { public: ReadOvenModeFeatureMap() : ReadAttribute("feature-map") { } ~ReadOvenModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenMode FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenModeFeatureMap : public SubscribeAttribute { public: SubscribeAttributeOvenModeFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeOvenModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadOvenModeClusterRevision : public ReadAttribute { public: ReadOvenModeClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadOvenModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OvenMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OvenMode ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOvenModeClusterRevision : public SubscribeAttribute { public: SubscribeAttributeOvenModeClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeOvenModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OvenMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OvenMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster LaundryDryerControls | 0x004A | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * SupportedDrynessLevels | 0x0000 | | * SelectedDrynessLevel | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedDrynessLevels */ class ReadLaundryDryerControlsSupportedDrynessLevels : public ReadAttribute { public: ReadLaundryDryerControlsSupportedDrynessLevels() : ReadAttribute("supported-dryness-levels") { } ~ReadLaundryDryerControlsSupportedDrynessLevels() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::SupportedDrynessLevels::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedDrynessLevelsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryDryerControls.SupportedDrynessLevels response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryDryerControls SupportedDrynessLevels read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryDryerControlsSupportedDrynessLevels : public SubscribeAttribute { public: SubscribeAttributeLaundryDryerControlsSupportedDrynessLevels() : SubscribeAttribute("supported-dryness-levels") { } ~SubscribeAttributeLaundryDryerControlsSupportedDrynessLevels() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::SupportedDrynessLevels::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedDrynessLevelsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryDryerControls.SupportedDrynessLevels response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SelectedDrynessLevel */ class ReadLaundryDryerControlsSelectedDrynessLevel : public ReadAttribute { public: ReadLaundryDryerControlsSelectedDrynessLevel() : ReadAttribute("selected-dryness-level") { } ~ReadLaundryDryerControlsSelectedDrynessLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::SelectedDrynessLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSelectedDrynessLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryDryerControls.SelectedDrynessLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryDryerControls SelectedDrynessLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteLaundryDryerControlsSelectedDrynessLevel : public WriteAttribute { public: WriteLaundryDryerControlsSelectedDrynessLevel() : WriteAttribute("selected-dryness-level") { AddArgument("attr-name", "selected-dryness-level"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteLaundryDryerControlsSelectedDrynessLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::SelectedDrynessLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeSelectedDrynessLevelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("LaundryDryerControls SelectedDrynessLevel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeLaundryDryerControlsSelectedDrynessLevel : public SubscribeAttribute { public: SubscribeAttributeLaundryDryerControlsSelectedDrynessLevel() : SubscribeAttribute("selected-dryness-level") { } ~SubscribeAttributeLaundryDryerControlsSelectedDrynessLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::SelectedDrynessLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSelectedDrynessLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryDryerControls.SelectedDrynessLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadLaundryDryerControlsGeneratedCommandList : public ReadAttribute { public: ReadLaundryDryerControlsGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadLaundryDryerControlsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryDryerControls.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryDryerControls GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryDryerControlsGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeLaundryDryerControlsGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeLaundryDryerControlsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryDryerControls.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadLaundryDryerControlsAcceptedCommandList : public ReadAttribute { public: ReadLaundryDryerControlsAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadLaundryDryerControlsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryDryerControls.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryDryerControls AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryDryerControlsAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeLaundryDryerControlsAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeLaundryDryerControlsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryDryerControls.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadLaundryDryerControlsEventList : public ReadAttribute { public: ReadLaundryDryerControlsEventList() : ReadAttribute("event-list") { } ~ReadLaundryDryerControlsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryDryerControls.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryDryerControls EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryDryerControlsEventList : public SubscribeAttribute { public: SubscribeAttributeLaundryDryerControlsEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeLaundryDryerControlsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryDryerControls.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadLaundryDryerControlsAttributeList : public ReadAttribute { public: ReadLaundryDryerControlsAttributeList() : ReadAttribute("attribute-list") { } ~ReadLaundryDryerControlsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryDryerControls.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryDryerControls AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryDryerControlsAttributeList : public SubscribeAttribute { public: SubscribeAttributeLaundryDryerControlsAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeLaundryDryerControlsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryDryerControls.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadLaundryDryerControlsFeatureMap : public ReadAttribute { public: ReadLaundryDryerControlsFeatureMap() : ReadAttribute("feature-map") { } ~ReadLaundryDryerControlsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryDryerControls.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryDryerControls FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryDryerControlsFeatureMap : public SubscribeAttribute { public: SubscribeAttributeLaundryDryerControlsFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeLaundryDryerControlsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryDryerControls.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadLaundryDryerControlsClusterRevision : public ReadAttribute { public: ReadLaundryDryerControlsClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadLaundryDryerControlsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryDryerControls.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryDryerControls ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryDryerControlsClusterRevision : public SubscribeAttribute { public: SubscribeAttributeLaundryDryerControlsClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeLaundryDryerControlsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryDryerControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryDryerControls::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryDryerControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryDryerControls.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster ModeSelect | 0x0050 | |------------------------------------------------------------------------------| | Commands: | | | * ChangeToMode | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * Description | 0x0000 | | * StandardNamespace | 0x0001 | | * SupportedModes | 0x0002 | | * CurrentMode | 0x0003 | | * StartUpMode | 0x0004 | | * OnMode | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command ChangeToMode */ class ModeSelectChangeToMode : public ClusterCommand { public: ModeSelectChangeToMode() : ClusterCommand("change-to-mode") { AddArgument("NewMode", 0, UINT8_MAX, &mRequest.newMode); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRModeSelectClusterChangeToModeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.newMode = [NSNumber numberWithUnsignedChar:mRequest.newMode]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster changeToModeWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type mRequest; }; /* * Attribute Description */ class ReadModeSelectDescription : public ReadAttribute { public: ReadModeSelectDescription() : ReadAttribute("description") { } ~ReadModeSelectDescription() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ModeSelect::Attributes::Description::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDescriptionWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.Description response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ModeSelect Description read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeModeSelectDescription : public SubscribeAttribute { public: SubscribeAttributeModeSelectDescription() : SubscribeAttribute("description") { } ~SubscribeAttributeModeSelectDescription() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ModeSelect::Attributes::Description::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDescriptionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.Description response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute StandardNamespace */ class ReadModeSelectStandardNamespace : public ReadAttribute { public: ReadModeSelectStandardNamespace() : ReadAttribute("standard-namespace") { } ~ReadModeSelectStandardNamespace() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ModeSelect::Attributes::StandardNamespace::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStandardNamespaceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.StandardNamespace response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ModeSelect StandardNamespace read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeModeSelectStandardNamespace : public SubscribeAttribute { public: SubscribeAttributeModeSelectStandardNamespace() : SubscribeAttribute("standard-namespace") { } ~SubscribeAttributeModeSelectStandardNamespace() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ModeSelect::Attributes::StandardNamespace::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStandardNamespaceWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.StandardNamespace response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SupportedModes */ class ReadModeSelectSupportedModes : public ReadAttribute { public: ReadModeSelectSupportedModes() : ReadAttribute("supported-modes") { } ~ReadModeSelectSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ModeSelect::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedModesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ModeSelect SupportedModes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeModeSelectSupportedModes : public SubscribeAttribute { public: SubscribeAttributeModeSelectSupportedModes() : SubscribeAttribute("supported-modes") { } ~SubscribeAttributeModeSelectSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ModeSelect::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedModesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentMode */ class ReadModeSelectCurrentMode : public ReadAttribute { public: ReadModeSelectCurrentMode() : ReadAttribute("current-mode") { } ~ReadModeSelectCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ModeSelect::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ModeSelect CurrentMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeModeSelectCurrentMode : public SubscribeAttribute { public: SubscribeAttributeModeSelectCurrentMode() : SubscribeAttribute("current-mode") { } ~SubscribeAttributeModeSelectCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ModeSelect::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute StartUpMode */ class ReadModeSelectStartUpMode : public ReadAttribute { public: ReadModeSelectStartUpMode() : ReadAttribute("start-up-mode") { } ~ReadModeSelectStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ModeSelect::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStartUpModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.StartUpMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ModeSelect StartUpMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteModeSelectStartUpMode : public WriteAttribute { public: WriteModeSelectStartUpMode() : WriteAttribute("start-up-mode") { AddArgument("attr-name", "start-up-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteModeSelectStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ModeSelect::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeStartUpModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ModeSelect StartUpMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeModeSelectStartUpMode : public SubscribeAttribute { public: SubscribeAttributeModeSelectStartUpMode() : SubscribeAttribute("start-up-mode") { } ~SubscribeAttributeModeSelectStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ModeSelect::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStartUpModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.StartUpMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OnMode */ class ReadModeSelectOnMode : public ReadAttribute { public: ReadModeSelectOnMode() : ReadAttribute("on-mode") { } ~ReadModeSelectOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ModeSelect::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOnModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.OnMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ModeSelect OnMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteModeSelectOnMode : public WriteAttribute { public: WriteModeSelectOnMode() : WriteAttribute("on-mode") { AddArgument("attr-name", "on-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteModeSelectOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ModeSelect::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeOnModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ModeSelect OnMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeModeSelectOnMode : public SubscribeAttribute { public: SubscribeAttributeModeSelectOnMode() : SubscribeAttribute("on-mode") { } ~SubscribeAttributeModeSelectOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ModeSelect::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOnModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.OnMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadModeSelectGeneratedCommandList : public ReadAttribute { public: ReadModeSelectGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadModeSelectGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ModeSelect::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ModeSelect GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeModeSelectGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeModeSelectGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeModeSelectGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ModeSelect::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadModeSelectAcceptedCommandList : public ReadAttribute { public: ReadModeSelectAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadModeSelectAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ModeSelect::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ModeSelect AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeModeSelectAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeModeSelectAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeModeSelectAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ModeSelect::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadModeSelectEventList : public ReadAttribute { public: ReadModeSelectEventList() : ReadAttribute("event-list") { } ~ReadModeSelectEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ModeSelect::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ModeSelect EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeModeSelectEventList : public SubscribeAttribute { public: SubscribeAttributeModeSelectEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeModeSelectEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ModeSelect::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadModeSelectAttributeList : public ReadAttribute { public: ReadModeSelectAttributeList() : ReadAttribute("attribute-list") { } ~ReadModeSelectAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ModeSelect::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ModeSelect AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeModeSelectAttributeList : public SubscribeAttribute { public: SubscribeAttributeModeSelectAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeModeSelectAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ModeSelect::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadModeSelectFeatureMap : public ReadAttribute { public: ReadModeSelectFeatureMap() : ReadAttribute("feature-map") { } ~ReadModeSelectFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ModeSelect::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ModeSelect FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeModeSelectFeatureMap : public SubscribeAttribute { public: SubscribeAttributeModeSelectFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeModeSelectFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ModeSelect::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadModeSelectClusterRevision : public ReadAttribute { public: ReadModeSelectClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadModeSelectClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ModeSelect::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ModeSelect ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeModeSelectClusterRevision : public SubscribeAttribute { public: SubscribeAttributeModeSelectClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeModeSelectClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ModeSelect::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ModeSelect::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster LaundryWasherMode | 0x0051 | |------------------------------------------------------------------------------| | Commands: | | | * ChangeToMode | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * SupportedModes | 0x0000 | | * CurrentMode | 0x0001 | | * StartUpMode | 0x0002 | | * OnMode | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command ChangeToMode */ class LaundryWasherModeChangeToMode : public ClusterCommand { public: LaundryWasherModeChangeToMode() : ClusterCommand("change-to-mode") { #if MTR_ENABLE_PROVISIONAL AddArgument("NewMode", 0, UINT8_MAX, &mRequest.newMode); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::CommandId commandId = chip::app::Clusters::LaundryWasherMode::Commands::ChangeToMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRLaundryWasherModeClusterChangeToModeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.newMode = [NSNumber numberWithUnsignedChar:mRequest.newMode]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster changeToModeWithParams:params completion: ^(MTRLaundryWasherModeClusterChangeToModeResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::LaundryWasherMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::LaundryWasherMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::LaundryWasherMode::Commands::ChangeToMode::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedModes */ class ReadLaundryWasherModeSupportedModes : public ReadAttribute { public: ReadLaundryWasherModeSupportedModes() : ReadAttribute("supported-modes") { } ~ReadLaundryWasherModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedModesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherMode SupportedModes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryWasherModeSupportedModes : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherModeSupportedModes() : SubscribeAttribute("supported-modes") { } ~SubscribeAttributeLaundryWasherModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedModesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentMode */ class ReadLaundryWasherModeCurrentMode : public ReadAttribute { public: ReadLaundryWasherModeCurrentMode() : ReadAttribute("current-mode") { } ~ReadLaundryWasherModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherMode CurrentMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryWasherModeCurrentMode : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherModeCurrentMode() : SubscribeAttribute("current-mode") { } ~SubscribeAttributeLaundryWasherModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute StartUpMode */ class ReadLaundryWasherModeStartUpMode : public ReadAttribute { public: ReadLaundryWasherModeStartUpMode() : ReadAttribute("start-up-mode") { } ~ReadLaundryWasherModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStartUpModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.StartUpMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherMode StartUpMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteLaundryWasherModeStartUpMode : public WriteAttribute { public: WriteLaundryWasherModeStartUpMode() : WriteAttribute("start-up-mode") { AddArgument("attr-name", "start-up-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteLaundryWasherModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeStartUpModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("LaundryWasherMode StartUpMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeLaundryWasherModeStartUpMode : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherModeStartUpMode() : SubscribeAttribute("start-up-mode") { } ~SubscribeAttributeLaundryWasherModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStartUpModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.StartUpMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute OnMode */ class ReadLaundryWasherModeOnMode : public ReadAttribute { public: ReadLaundryWasherModeOnMode() : ReadAttribute("on-mode") { } ~ReadLaundryWasherModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOnModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.OnMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherMode OnMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteLaundryWasherModeOnMode : public WriteAttribute { public: WriteLaundryWasherModeOnMode() : WriteAttribute("on-mode") { AddArgument("attr-name", "on-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteLaundryWasherModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeOnModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("LaundryWasherMode OnMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeLaundryWasherModeOnMode : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherModeOnMode() : SubscribeAttribute("on-mode") { } ~SubscribeAttributeLaundryWasherModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOnModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.OnMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadLaundryWasherModeGeneratedCommandList : public ReadAttribute { public: ReadLaundryWasherModeGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadLaundryWasherModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherMode GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryWasherModeGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherModeGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeLaundryWasherModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadLaundryWasherModeAcceptedCommandList : public ReadAttribute { public: ReadLaundryWasherModeAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadLaundryWasherModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherMode AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryWasherModeAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherModeAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeLaundryWasherModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadLaundryWasherModeEventList : public ReadAttribute { public: ReadLaundryWasherModeEventList() : ReadAttribute("event-list") { } ~ReadLaundryWasherModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherMode EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryWasherModeEventList : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherModeEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeLaundryWasherModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadLaundryWasherModeAttributeList : public ReadAttribute { public: ReadLaundryWasherModeAttributeList() : ReadAttribute("attribute-list") { } ~ReadLaundryWasherModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherMode AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryWasherModeAttributeList : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherModeAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeLaundryWasherModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadLaundryWasherModeFeatureMap : public ReadAttribute { public: ReadLaundryWasherModeFeatureMap() : ReadAttribute("feature-map") { } ~ReadLaundryWasherModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherMode FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryWasherModeFeatureMap : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherModeFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeLaundryWasherModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadLaundryWasherModeClusterRevision : public ReadAttribute { public: ReadLaundryWasherModeClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadLaundryWasherModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherMode ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryWasherModeClusterRevision : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherModeClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeLaundryWasherModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster RefrigeratorAndTemperatureControlledCabinetMode | 0x0052 | |------------------------------------------------------------------------------| | Commands: | | | * ChangeToMode | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * SupportedModes | 0x0000 | | * CurrentMode | 0x0001 | | * StartUpMode | 0x0002 | | * OnMode | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command ChangeToMode */ class RefrigeratorAndTemperatureControlledCabinetModeChangeToMode : public ClusterCommand { public: RefrigeratorAndTemperatureControlledCabinetModeChangeToMode() : ClusterCommand("change-to-mode") { #if MTR_ENABLE_PROVISIONAL AddArgument("NewMode", 0, UINT8_MAX, &mRequest.newMode); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::CommandId commandId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Commands::ChangeToMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.newMode = [NSNumber numberWithUnsignedChar:mRequest.newMode]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster changeToModeWithParams:params completion: ^(MTRRefrigeratorAndTemperatureControlledCabinetModeClusterChangeToModeResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Commands::ChangeToMode::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedModes */ class ReadRefrigeratorAndTemperatureControlledCabinetModeSupportedModes : public ReadAttribute { public: ReadRefrigeratorAndTemperatureControlledCabinetModeSupportedModes() : ReadAttribute("supported-modes") { } ~ReadRefrigeratorAndTemperatureControlledCabinetModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedModesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAndTemperatureControlledCabinetMode SupportedModes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeSupportedModes : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeSupportedModes() : SubscribeAttribute("supported-modes") { } ~SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedModesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentMode */ class ReadRefrigeratorAndTemperatureControlledCabinetModeCurrentMode : public ReadAttribute { public: ReadRefrigeratorAndTemperatureControlledCabinetModeCurrentMode() : ReadAttribute("current-mode") { } ~ReadRefrigeratorAndTemperatureControlledCabinetModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAndTemperatureControlledCabinetMode CurrentMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeCurrentMode : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeCurrentMode() : SubscribeAttribute("current-mode") { } ~SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute StartUpMode */ class ReadRefrigeratorAndTemperatureControlledCabinetModeStartUpMode : public ReadAttribute { public: ReadRefrigeratorAndTemperatureControlledCabinetModeStartUpMode() : ReadAttribute("start-up-mode") { } ~ReadRefrigeratorAndTemperatureControlledCabinetModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStartUpModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.StartUpMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAndTemperatureControlledCabinetMode StartUpMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteRefrigeratorAndTemperatureControlledCabinetModeStartUpMode : public WriteAttribute { public: WriteRefrigeratorAndTemperatureControlledCabinetModeStartUpMode() : WriteAttribute("start-up-mode") { AddArgument("attr-name", "start-up-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteRefrigeratorAndTemperatureControlledCabinetModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeStartUpModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("RefrigeratorAndTemperatureControlledCabinetMode StartUpMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeStartUpMode : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeStartUpMode() : SubscribeAttribute("start-up-mode") { } ~SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStartUpModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.StartUpMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute OnMode */ class ReadRefrigeratorAndTemperatureControlledCabinetModeOnMode : public ReadAttribute { public: ReadRefrigeratorAndTemperatureControlledCabinetModeOnMode() : ReadAttribute("on-mode") { } ~ReadRefrigeratorAndTemperatureControlledCabinetModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOnModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.OnMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAndTemperatureControlledCabinetMode OnMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteRefrigeratorAndTemperatureControlledCabinetModeOnMode : public WriteAttribute { public: WriteRefrigeratorAndTemperatureControlledCabinetModeOnMode() : WriteAttribute("on-mode") { AddArgument("attr-name", "on-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteRefrigeratorAndTemperatureControlledCabinetModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeOnModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("RefrigeratorAndTemperatureControlledCabinetMode OnMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeOnMode : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeOnMode() : SubscribeAttribute("on-mode") { } ~SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOnModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.OnMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandList : public ReadAttribute { public: ReadRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAndTemperatureControlledCabinetMode GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandList : public ReadAttribute { public: ReadRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAndTemperatureControlledCabinetMode AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadRefrigeratorAndTemperatureControlledCabinetModeEventList : public ReadAttribute { public: ReadRefrigeratorAndTemperatureControlledCabinetModeEventList() : ReadAttribute("event-list") { } ~ReadRefrigeratorAndTemperatureControlledCabinetModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAndTemperatureControlledCabinetMode EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeEventList : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadRefrigeratorAndTemperatureControlledCabinetModeAttributeList : public ReadAttribute { public: ReadRefrigeratorAndTemperatureControlledCabinetModeAttributeList() : ReadAttribute("attribute-list") { } ~ReadRefrigeratorAndTemperatureControlledCabinetModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAndTemperatureControlledCabinetMode AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeAttributeList : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadRefrigeratorAndTemperatureControlledCabinetModeFeatureMap : public ReadAttribute { public: ReadRefrigeratorAndTemperatureControlledCabinetModeFeatureMap() : ReadAttribute("feature-map") { } ~ReadRefrigeratorAndTemperatureControlledCabinetModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAndTemperatureControlledCabinetMode FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeFeatureMap : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadRefrigeratorAndTemperatureControlledCabinetModeClusterRevision : public ReadAttribute { public: ReadRefrigeratorAndTemperatureControlledCabinetModeClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadRefrigeratorAndTemperatureControlledCabinetModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAndTemperatureControlledCabinetMode ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeClusterRevision : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeRefrigeratorAndTemperatureControlledCabinetModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAndTemperatureControlledCabinetMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster LaundryWasherControls | 0x0053 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * SpinSpeeds | 0x0000 | | * SpinSpeedCurrent | 0x0001 | | * NumberOfRinses | 0x0002 | | * SupportedRinses | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Attribute SpinSpeeds */ class ReadLaundryWasherControlsSpinSpeeds : public ReadAttribute { public: ReadLaundryWasherControlsSpinSpeeds() : ReadAttribute("spin-speeds") { } ~ReadLaundryWasherControlsSpinSpeeds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::SpinSpeeds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSpinSpeedsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.SpinSpeeds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherControls SpinSpeeds read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryWasherControlsSpinSpeeds : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherControlsSpinSpeeds() : SubscribeAttribute("spin-speeds") { } ~SubscribeAttributeLaundryWasherControlsSpinSpeeds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::SpinSpeeds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSpinSpeedsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.SpinSpeeds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SpinSpeedCurrent */ class ReadLaundryWasherControlsSpinSpeedCurrent : public ReadAttribute { public: ReadLaundryWasherControlsSpinSpeedCurrent() : ReadAttribute("spin-speed-current") { } ~ReadLaundryWasherControlsSpinSpeedCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::SpinSpeedCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSpinSpeedCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.SpinSpeedCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherControls SpinSpeedCurrent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteLaundryWasherControlsSpinSpeedCurrent : public WriteAttribute { public: WriteLaundryWasherControlsSpinSpeedCurrent() : WriteAttribute("spin-speed-current") { AddArgument("attr-name", "spin-speed-current"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteLaundryWasherControlsSpinSpeedCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::SpinSpeedCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeSpinSpeedCurrentWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("LaundryWasherControls SpinSpeedCurrent write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeLaundryWasherControlsSpinSpeedCurrent : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherControlsSpinSpeedCurrent() : SubscribeAttribute("spin-speed-current") { } ~SubscribeAttributeLaundryWasherControlsSpinSpeedCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::SpinSpeedCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSpinSpeedCurrentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.SpinSpeedCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NumberOfRinses */ class ReadLaundryWasherControlsNumberOfRinses : public ReadAttribute { public: ReadLaundryWasherControlsNumberOfRinses() : ReadAttribute("number-of-rinses") { } ~ReadLaundryWasherControlsNumberOfRinses() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::NumberOfRinses::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfRinsesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.NumberOfRinses response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherControls NumberOfRinses read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteLaundryWasherControlsNumberOfRinses : public WriteAttribute { public: WriteLaundryWasherControlsNumberOfRinses() : WriteAttribute("number-of-rinses") { AddArgument("attr-name", "number-of-rinses"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteLaundryWasherControlsNumberOfRinses() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::NumberOfRinses::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeNumberOfRinsesWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("LaundryWasherControls NumberOfRinses write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeLaundryWasherControlsNumberOfRinses : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherControlsNumberOfRinses() : SubscribeAttribute("number-of-rinses") { } ~SubscribeAttributeLaundryWasherControlsNumberOfRinses() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::NumberOfRinses::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfRinsesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.NumberOfRinses response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedRinses */ class ReadLaundryWasherControlsSupportedRinses : public ReadAttribute { public: ReadLaundryWasherControlsSupportedRinses() : ReadAttribute("supported-rinses") { } ~ReadLaundryWasherControlsSupportedRinses() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::SupportedRinses::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedRinsesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.SupportedRinses response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherControls SupportedRinses read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryWasherControlsSupportedRinses : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherControlsSupportedRinses() : SubscribeAttribute("supported-rinses") { } ~SubscribeAttributeLaundryWasherControlsSupportedRinses() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::SupportedRinses::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedRinsesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.SupportedRinses response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadLaundryWasherControlsGeneratedCommandList : public ReadAttribute { public: ReadLaundryWasherControlsGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadLaundryWasherControlsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherControls GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryWasherControlsGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherControlsGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeLaundryWasherControlsGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadLaundryWasherControlsAcceptedCommandList : public ReadAttribute { public: ReadLaundryWasherControlsAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadLaundryWasherControlsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherControls AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryWasherControlsAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherControlsAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeLaundryWasherControlsAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadLaundryWasherControlsEventList : public ReadAttribute { public: ReadLaundryWasherControlsEventList() : ReadAttribute("event-list") { } ~ReadLaundryWasherControlsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherControls EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryWasherControlsEventList : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherControlsEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeLaundryWasherControlsEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadLaundryWasherControlsAttributeList : public ReadAttribute { public: ReadLaundryWasherControlsAttributeList() : ReadAttribute("attribute-list") { } ~ReadLaundryWasherControlsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherControls AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryWasherControlsAttributeList : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherControlsAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeLaundryWasherControlsAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadLaundryWasherControlsFeatureMap : public ReadAttribute { public: ReadLaundryWasherControlsFeatureMap() : ReadAttribute("feature-map") { } ~ReadLaundryWasherControlsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherControls FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryWasherControlsFeatureMap : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherControlsFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeLaundryWasherControlsFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadLaundryWasherControlsClusterRevision : public ReadAttribute { public: ReadLaundryWasherControlsClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadLaundryWasherControlsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LaundryWasherControls ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLaundryWasherControlsClusterRevision : public SubscribeAttribute { public: SubscribeAttributeLaundryWasherControlsClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeLaundryWasherControlsClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LaundryWasherControls::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LaundryWasherControls::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLaundryWasherControls alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LaundryWasherControls.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster RvcRunMode | 0x0054 | |------------------------------------------------------------------------------| | Commands: | | | * ChangeToMode | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * SupportedModes | 0x0000 | | * CurrentMode | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command ChangeToMode */ class RvcRunModeChangeToMode : public ClusterCommand { public: RvcRunModeChangeToMode() : ClusterCommand("change-to-mode") { AddArgument("NewMode", 0, UINT8_MAX, &mRequest.newMode); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::CommandId commandId = chip::app::Clusters::RvcRunMode::Commands::ChangeToMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRRVCRunModeClusterChangeToModeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.newMode = [NSNumber numberWithUnsignedChar:mRequest.newMode]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster changeToModeWithParams:params completion: ^(MTRRVCRunModeClusterChangeToModeResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::RvcRunMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::RvcRunMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::RvcRunMode::Commands::ChangeToMode::Type mRequest; }; /* * Attribute SupportedModes */ class ReadRvcRunModeSupportedModes : public ReadAttribute { public: ReadRvcRunModeSupportedModes() : ReadAttribute("supported-modes") { } ~ReadRvcRunModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcRunMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedModesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCRunMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCRunMode SupportedModes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcRunModeSupportedModes : public SubscribeAttribute { public: SubscribeAttributeRvcRunModeSupportedModes() : SubscribeAttribute("supported-modes") { } ~SubscribeAttributeRvcRunModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcRunMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedModesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCRunMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentMode */ class ReadRvcRunModeCurrentMode : public ReadAttribute { public: ReadRvcRunModeCurrentMode() : ReadAttribute("current-mode") { } ~ReadRvcRunModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcRunMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCRunMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCRunMode CurrentMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcRunModeCurrentMode : public SubscribeAttribute { public: SubscribeAttributeRvcRunModeCurrentMode() : SubscribeAttribute("current-mode") { } ~SubscribeAttributeRvcRunModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcRunMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCRunMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadRvcRunModeGeneratedCommandList : public ReadAttribute { public: ReadRvcRunModeGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadRvcRunModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcRunMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCRunMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCRunMode GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcRunModeGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeRvcRunModeGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeRvcRunModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcRunMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCRunMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadRvcRunModeAcceptedCommandList : public ReadAttribute { public: ReadRvcRunModeAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadRvcRunModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcRunMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCRunMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCRunMode AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcRunModeAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeRvcRunModeAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeRvcRunModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcRunMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCRunMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadRvcRunModeEventList : public ReadAttribute { public: ReadRvcRunModeEventList() : ReadAttribute("event-list") { } ~ReadRvcRunModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcRunMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCRunMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCRunMode EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcRunModeEventList : public SubscribeAttribute { public: SubscribeAttributeRvcRunModeEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeRvcRunModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcRunMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCRunMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadRvcRunModeAttributeList : public ReadAttribute { public: ReadRvcRunModeAttributeList() : ReadAttribute("attribute-list") { } ~ReadRvcRunModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcRunMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCRunMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCRunMode AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcRunModeAttributeList : public SubscribeAttribute { public: SubscribeAttributeRvcRunModeAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeRvcRunModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcRunMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCRunMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadRvcRunModeFeatureMap : public ReadAttribute { public: ReadRvcRunModeFeatureMap() : ReadAttribute("feature-map") { } ~ReadRvcRunModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcRunMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCRunMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCRunMode FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcRunModeFeatureMap : public SubscribeAttribute { public: SubscribeAttributeRvcRunModeFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeRvcRunModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcRunMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCRunMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadRvcRunModeClusterRevision : public ReadAttribute { public: ReadRvcRunModeClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadRvcRunModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcRunMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCRunMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCRunMode ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcRunModeClusterRevision : public SubscribeAttribute { public: SubscribeAttributeRvcRunModeClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeRvcRunModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcRunMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcRunMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCRunMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster RvcCleanMode | 0x0055 | |------------------------------------------------------------------------------| | Commands: | | | * ChangeToMode | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * SupportedModes | 0x0000 | | * CurrentMode | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command ChangeToMode */ class RvcCleanModeChangeToMode : public ClusterCommand { public: RvcCleanModeChangeToMode() : ClusterCommand("change-to-mode") { AddArgument("NewMode", 0, UINT8_MAX, &mRequest.newMode); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::CommandId commandId = chip::app::Clusters::RvcCleanMode::Commands::ChangeToMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRRVCCleanModeClusterChangeToModeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.newMode = [NSNumber numberWithUnsignedChar:mRequest.newMode]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster changeToModeWithParams:params completion: ^(MTRRVCCleanModeClusterChangeToModeResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::RvcCleanMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::RvcCleanMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::RvcCleanMode::Commands::ChangeToMode::Type mRequest; }; /* * Attribute SupportedModes */ class ReadRvcCleanModeSupportedModes : public ReadAttribute { public: ReadRvcCleanModeSupportedModes() : ReadAttribute("supported-modes") { } ~ReadRvcCleanModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcCleanMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedModesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCCleanMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCCleanMode SupportedModes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcCleanModeSupportedModes : public SubscribeAttribute { public: SubscribeAttributeRvcCleanModeSupportedModes() : SubscribeAttribute("supported-modes") { } ~SubscribeAttributeRvcCleanModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcCleanMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedModesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCCleanMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentMode */ class ReadRvcCleanModeCurrentMode : public ReadAttribute { public: ReadRvcCleanModeCurrentMode() : ReadAttribute("current-mode") { } ~ReadRvcCleanModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcCleanMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCCleanMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCCleanMode CurrentMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcCleanModeCurrentMode : public SubscribeAttribute { public: SubscribeAttributeRvcCleanModeCurrentMode() : SubscribeAttribute("current-mode") { } ~SubscribeAttributeRvcCleanModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcCleanMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCCleanMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadRvcCleanModeGeneratedCommandList : public ReadAttribute { public: ReadRvcCleanModeGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadRvcCleanModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcCleanMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCCleanMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCCleanMode GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcCleanModeGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeRvcCleanModeGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeRvcCleanModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcCleanMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCCleanMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadRvcCleanModeAcceptedCommandList : public ReadAttribute { public: ReadRvcCleanModeAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadRvcCleanModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcCleanMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCCleanMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCCleanMode AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcCleanModeAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeRvcCleanModeAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeRvcCleanModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcCleanMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCCleanMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadRvcCleanModeEventList : public ReadAttribute { public: ReadRvcCleanModeEventList() : ReadAttribute("event-list") { } ~ReadRvcCleanModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcCleanMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCCleanMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCCleanMode EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcCleanModeEventList : public SubscribeAttribute { public: SubscribeAttributeRvcCleanModeEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeRvcCleanModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcCleanMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCCleanMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadRvcCleanModeAttributeList : public ReadAttribute { public: ReadRvcCleanModeAttributeList() : ReadAttribute("attribute-list") { } ~ReadRvcCleanModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcCleanMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCCleanMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCCleanMode AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcCleanModeAttributeList : public SubscribeAttribute { public: SubscribeAttributeRvcCleanModeAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeRvcCleanModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcCleanMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCCleanMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadRvcCleanModeFeatureMap : public ReadAttribute { public: ReadRvcCleanModeFeatureMap() : ReadAttribute("feature-map") { } ~ReadRvcCleanModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcCleanMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCCleanMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCCleanMode FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcCleanModeFeatureMap : public SubscribeAttribute { public: SubscribeAttributeRvcCleanModeFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeRvcCleanModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcCleanMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCCleanMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadRvcCleanModeClusterRevision : public ReadAttribute { public: ReadRvcCleanModeClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadRvcCleanModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcCleanMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCCleanMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCCleanMode ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcCleanModeClusterRevision : public SubscribeAttribute { public: SubscribeAttributeRvcCleanModeClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeRvcCleanModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcCleanMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcCleanMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCCleanMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster TemperatureControl | 0x0056 | |------------------------------------------------------------------------------| | Commands: | | | * SetTemperature | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * TemperatureSetpoint | 0x0000 | | * MinTemperature | 0x0001 | | * MaxTemperature | 0x0002 | | * Step | 0x0003 | | * SelectedTemperatureLevel | 0x0004 | | * SupportedTemperatureLevels | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command SetTemperature */ class TemperatureControlSetTemperature : public ClusterCommand { public: TemperatureControlSetTemperature() : ClusterCommand("set-temperature") { #if MTR_ENABLE_PROVISIONAL AddArgument("TargetTemperature", INT16_MIN, INT16_MAX, &mRequest.targetTemperature); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("TargetTemperatureLevel", 0, UINT8_MAX, &mRequest.targetTemperatureLevel); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::TemperatureControl::Commands::SetTemperature::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRTemperatureControlClusterSetTemperatureParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.targetTemperature.HasValue()) { params.targetTemperature = [NSNumber numberWithShort:mRequest.targetTemperature.Value()]; } else { params.targetTemperature = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.targetTemperatureLevel.HasValue()) { params.targetTemperatureLevel = [NSNumber numberWithUnsignedChar:mRequest.targetTemperatureLevel.Value()]; } else { params.targetTemperatureLevel = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setTemperatureWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::TemperatureControl::Commands::SetTemperature::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute TemperatureSetpoint */ class ReadTemperatureControlTemperatureSetpoint : public ReadAttribute { public: ReadTemperatureControlTemperatureSetpoint() : ReadAttribute("temperature-setpoint") { } ~ReadTemperatureControlTemperatureSetpoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureControl::Attributes::TemperatureSetpoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTemperatureSetpointWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.TemperatureSetpoint response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureControl TemperatureSetpoint read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureControlTemperatureSetpoint : public SubscribeAttribute { public: SubscribeAttributeTemperatureControlTemperatureSetpoint() : SubscribeAttribute("temperature-setpoint") { } ~SubscribeAttributeTemperatureControlTemperatureSetpoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureControl::Attributes::TemperatureSetpoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTemperatureSetpointWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.TemperatureSetpoint response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MinTemperature */ class ReadTemperatureControlMinTemperature : public ReadAttribute { public: ReadTemperatureControlMinTemperature() : ReadAttribute("min-temperature") { } ~ReadTemperatureControlMinTemperature() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureControl::Attributes::MinTemperature::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinTemperatureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.MinTemperature response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureControl MinTemperature read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureControlMinTemperature : public SubscribeAttribute { public: SubscribeAttributeTemperatureControlMinTemperature() : SubscribeAttribute("min-temperature") { } ~SubscribeAttributeTemperatureControlMinTemperature() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureControl::Attributes::MinTemperature::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinTemperatureWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.MinTemperature response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MaxTemperature */ class ReadTemperatureControlMaxTemperature : public ReadAttribute { public: ReadTemperatureControlMaxTemperature() : ReadAttribute("max-temperature") { } ~ReadTemperatureControlMaxTemperature() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureControl::Attributes::MaxTemperature::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxTemperatureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.MaxTemperature response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureControl MaxTemperature read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureControlMaxTemperature : public SubscribeAttribute { public: SubscribeAttributeTemperatureControlMaxTemperature() : SubscribeAttribute("max-temperature") { } ~SubscribeAttributeTemperatureControlMaxTemperature() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureControl::Attributes::MaxTemperature::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxTemperatureWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.MaxTemperature response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Step */ class ReadTemperatureControlStep : public ReadAttribute { public: ReadTemperatureControlStep() : ReadAttribute("step") { } ~ReadTemperatureControlStep() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureControl::Attributes::Step::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStepWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.Step response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureControl Step read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureControlStep : public SubscribeAttribute { public: SubscribeAttributeTemperatureControlStep() : SubscribeAttribute("step") { } ~SubscribeAttributeTemperatureControlStep() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureControl::Attributes::Step::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStepWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.Step response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SelectedTemperatureLevel */ class ReadTemperatureControlSelectedTemperatureLevel : public ReadAttribute { public: ReadTemperatureControlSelectedTemperatureLevel() : ReadAttribute("selected-temperature-level") { } ~ReadTemperatureControlSelectedTemperatureLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureControl::Attributes::SelectedTemperatureLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSelectedTemperatureLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.SelectedTemperatureLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureControl SelectedTemperatureLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureControlSelectedTemperatureLevel : public SubscribeAttribute { public: SubscribeAttributeTemperatureControlSelectedTemperatureLevel() : SubscribeAttribute("selected-temperature-level") { } ~SubscribeAttributeTemperatureControlSelectedTemperatureLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureControl::Attributes::SelectedTemperatureLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSelectedTemperatureLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.SelectedTemperatureLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedTemperatureLevels */ class ReadTemperatureControlSupportedTemperatureLevels : public ReadAttribute { public: ReadTemperatureControlSupportedTemperatureLevels() : ReadAttribute("supported-temperature-levels") { } ~ReadTemperatureControlSupportedTemperatureLevels() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureControl::Attributes::SupportedTemperatureLevels::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedTemperatureLevelsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.SupportedTemperatureLevels response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureControl SupportedTemperatureLevels read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureControlSupportedTemperatureLevels : public SubscribeAttribute { public: SubscribeAttributeTemperatureControlSupportedTemperatureLevels() : SubscribeAttribute("supported-temperature-levels") { } ~SubscribeAttributeTemperatureControlSupportedTemperatureLevels() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureControl::Attributes::SupportedTemperatureLevels::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedTemperatureLevelsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.SupportedTemperatureLevels response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadTemperatureControlGeneratedCommandList : public ReadAttribute { public: ReadTemperatureControlGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadTemperatureControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureControl GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureControlGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeTemperatureControlGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeTemperatureControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadTemperatureControlAcceptedCommandList : public ReadAttribute { public: ReadTemperatureControlAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadTemperatureControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureControl AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureControlAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeTemperatureControlAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeTemperatureControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadTemperatureControlEventList : public ReadAttribute { public: ReadTemperatureControlEventList() : ReadAttribute("event-list") { } ~ReadTemperatureControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureControl EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureControlEventList : public SubscribeAttribute { public: SubscribeAttributeTemperatureControlEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeTemperatureControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadTemperatureControlAttributeList : public ReadAttribute { public: ReadTemperatureControlAttributeList() : ReadAttribute("attribute-list") { } ~ReadTemperatureControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureControl AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureControlAttributeList : public SubscribeAttribute { public: SubscribeAttributeTemperatureControlAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeTemperatureControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadTemperatureControlFeatureMap : public ReadAttribute { public: ReadTemperatureControlFeatureMap() : ReadAttribute("feature-map") { } ~ReadTemperatureControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureControl FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureControlFeatureMap : public SubscribeAttribute { public: SubscribeAttributeTemperatureControlFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeTemperatureControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadTemperatureControlClusterRevision : public ReadAttribute { public: ReadTemperatureControlClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadTemperatureControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureControl ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureControlClusterRevision : public SubscribeAttribute { public: SubscribeAttributeTemperatureControlClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeTemperatureControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster RefrigeratorAlarm | 0x0057 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * Mask | 0x0000 | | * State | 0x0002 | | * Supported | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * Notify | 0x0000 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Attribute Mask */ class ReadRefrigeratorAlarmMask : public ReadAttribute { public: ReadRefrigeratorAlarmMask() : ReadAttribute("mask") { } ~ReadRefrigeratorAlarmMask() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::Mask::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaskWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.Mask response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAlarm Mask read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAlarmMask : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAlarmMask() : SubscribeAttribute("mask") { } ~SubscribeAttributeRefrigeratorAlarmMask() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::Mask::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaskWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.Mask response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute State */ class ReadRefrigeratorAlarmState : public ReadAttribute { public: ReadRefrigeratorAlarmState() : ReadAttribute("state") { } ~ReadRefrigeratorAlarmState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::State::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.State response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAlarm State read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAlarmState : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAlarmState() : SubscribeAttribute("state") { } ~SubscribeAttributeRefrigeratorAlarmState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::State::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.State response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Supported */ class ReadRefrigeratorAlarmSupported : public ReadAttribute { public: ReadRefrigeratorAlarmSupported() : ReadAttribute("supported") { } ~ReadRefrigeratorAlarmSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::Supported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.Supported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAlarm Supported read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAlarmSupported : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAlarmSupported() : SubscribeAttribute("supported") { } ~SubscribeAttributeRefrigeratorAlarmSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::Supported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.Supported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadRefrigeratorAlarmGeneratedCommandList : public ReadAttribute { public: ReadRefrigeratorAlarmGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadRefrigeratorAlarmGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAlarm GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAlarmGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAlarmGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeRefrigeratorAlarmGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadRefrigeratorAlarmAcceptedCommandList : public ReadAttribute { public: ReadRefrigeratorAlarmAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadRefrigeratorAlarmAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAlarm AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAlarmAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAlarmAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeRefrigeratorAlarmAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadRefrigeratorAlarmEventList : public ReadAttribute { public: ReadRefrigeratorAlarmEventList() : ReadAttribute("event-list") { } ~ReadRefrigeratorAlarmEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAlarm EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAlarmEventList : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAlarmEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeRefrigeratorAlarmEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadRefrigeratorAlarmAttributeList : public ReadAttribute { public: ReadRefrigeratorAlarmAttributeList() : ReadAttribute("attribute-list") { } ~ReadRefrigeratorAlarmAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAlarm AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAlarmAttributeList : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAlarmAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeRefrigeratorAlarmAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadRefrigeratorAlarmFeatureMap : public ReadAttribute { public: ReadRefrigeratorAlarmFeatureMap() : ReadAttribute("feature-map") { } ~ReadRefrigeratorAlarmFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAlarm FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAlarmFeatureMap : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAlarmFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeRefrigeratorAlarmFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadRefrigeratorAlarmClusterRevision : public ReadAttribute { public: ReadRefrigeratorAlarmClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadRefrigeratorAlarmClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RefrigeratorAlarm ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRefrigeratorAlarmClusterRevision : public SubscribeAttribute { public: SubscribeAttributeRefrigeratorAlarmClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeRefrigeratorAlarmClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RefrigeratorAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RefrigeratorAlarm::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRefrigeratorAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RefrigeratorAlarm.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster DishwasherMode | 0x0059 | |------------------------------------------------------------------------------| | Commands: | | | * ChangeToMode | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * SupportedModes | 0x0000 | | * CurrentMode | 0x0001 | | * StartUpMode | 0x0002 | | * OnMode | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command ChangeToMode */ class DishwasherModeChangeToMode : public ClusterCommand { public: DishwasherModeChangeToMode() : ClusterCommand("change-to-mode") { #if MTR_ENABLE_PROVISIONAL AddArgument("NewMode", 0, UINT8_MAX, &mRequest.newMode); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DishwasherMode::Commands::ChangeToMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDishwasherModeClusterChangeToModeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.newMode = [NSNumber numberWithUnsignedChar:mRequest.newMode]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster changeToModeWithParams:params completion: ^(MTRDishwasherModeClusterChangeToModeResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::DishwasherMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::DishwasherMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DishwasherMode::Commands::ChangeToMode::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedModes */ class ReadDishwasherModeSupportedModes : public ReadAttribute { public: ReadDishwasherModeSupportedModes() : ReadAttribute("supported-modes") { } ~ReadDishwasherModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedModesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherMode SupportedModes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherModeSupportedModes : public SubscribeAttribute { public: SubscribeAttributeDishwasherModeSupportedModes() : SubscribeAttribute("supported-modes") { } ~SubscribeAttributeDishwasherModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedModesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentMode */ class ReadDishwasherModeCurrentMode : public ReadAttribute { public: ReadDishwasherModeCurrentMode() : ReadAttribute("current-mode") { } ~ReadDishwasherModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherMode CurrentMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherModeCurrentMode : public SubscribeAttribute { public: SubscribeAttributeDishwasherModeCurrentMode() : SubscribeAttribute("current-mode") { } ~SubscribeAttributeDishwasherModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute StartUpMode */ class ReadDishwasherModeStartUpMode : public ReadAttribute { public: ReadDishwasherModeStartUpMode() : ReadAttribute("start-up-mode") { } ~ReadDishwasherModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStartUpModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.StartUpMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherMode StartUpMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDishwasherModeStartUpMode : public WriteAttribute { public: WriteDishwasherModeStartUpMode() : WriteAttribute("start-up-mode") { AddArgument("attr-name", "start-up-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDishwasherModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeStartUpModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DishwasherMode StartUpMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeDishwasherModeStartUpMode : public SubscribeAttribute { public: SubscribeAttributeDishwasherModeStartUpMode() : SubscribeAttribute("start-up-mode") { } ~SubscribeAttributeDishwasherModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStartUpModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.StartUpMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute OnMode */ class ReadDishwasherModeOnMode : public ReadAttribute { public: ReadDishwasherModeOnMode() : ReadAttribute("on-mode") { } ~ReadDishwasherModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOnModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.OnMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherMode OnMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDishwasherModeOnMode : public WriteAttribute { public: WriteDishwasherModeOnMode() : WriteAttribute("on-mode") { AddArgument("attr-name", "on-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDishwasherModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeOnModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DishwasherMode OnMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeDishwasherModeOnMode : public SubscribeAttribute { public: SubscribeAttributeDishwasherModeOnMode() : SubscribeAttribute("on-mode") { } ~SubscribeAttributeDishwasherModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOnModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.OnMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadDishwasherModeGeneratedCommandList : public ReadAttribute { public: ReadDishwasherModeGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadDishwasherModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherMode GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherModeGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeDishwasherModeGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeDishwasherModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadDishwasherModeAcceptedCommandList : public ReadAttribute { public: ReadDishwasherModeAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadDishwasherModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherMode AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherModeAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeDishwasherModeAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeDishwasherModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadDishwasherModeEventList : public ReadAttribute { public: ReadDishwasherModeEventList() : ReadAttribute("event-list") { } ~ReadDishwasherModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherMode EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherModeEventList : public SubscribeAttribute { public: SubscribeAttributeDishwasherModeEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeDishwasherModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadDishwasherModeAttributeList : public ReadAttribute { public: ReadDishwasherModeAttributeList() : ReadAttribute("attribute-list") { } ~ReadDishwasherModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherMode AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherModeAttributeList : public SubscribeAttribute { public: SubscribeAttributeDishwasherModeAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeDishwasherModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadDishwasherModeFeatureMap : public ReadAttribute { public: ReadDishwasherModeFeatureMap() : ReadAttribute("feature-map") { } ~ReadDishwasherModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherMode FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherModeFeatureMap : public SubscribeAttribute { public: SubscribeAttributeDishwasherModeFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeDishwasherModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadDishwasherModeClusterRevision : public ReadAttribute { public: ReadDishwasherModeClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadDishwasherModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherMode ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherModeClusterRevision : public SubscribeAttribute { public: SubscribeAttributeDishwasherModeClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeDishwasherModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster AirQuality | 0x005B | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * AirQuality | 0x0000 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute AirQuality */ class ReadAirQualityAirQuality : public ReadAttribute { public: ReadAirQualityAirQuality() : ReadAttribute("air-quality") { } ~ReadAirQualityAirQuality() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AirQuality::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AirQuality::Attributes::AirQuality::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAirQualityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AirQuality.AirQuality response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AirQuality AirQuality read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAirQualityAirQuality : public SubscribeAttribute { public: SubscribeAttributeAirQualityAirQuality() : SubscribeAttribute("air-quality") { } ~SubscribeAttributeAirQualityAirQuality() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AirQuality::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AirQuality::Attributes::AirQuality::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAirQualityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AirQuality.AirQuality response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadAirQualityGeneratedCommandList : public ReadAttribute { public: ReadAirQualityGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadAirQualityGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AirQuality::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AirQuality::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AirQuality.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AirQuality GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAirQualityGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeAirQualityGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeAirQualityGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AirQuality::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AirQuality::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AirQuality.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadAirQualityAcceptedCommandList : public ReadAttribute { public: ReadAirQualityAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadAirQualityAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AirQuality::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AirQuality::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AirQuality.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AirQuality AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAirQualityAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeAirQualityAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeAirQualityAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AirQuality::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AirQuality::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AirQuality.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadAirQualityEventList : public ReadAttribute { public: ReadAirQualityEventList() : ReadAttribute("event-list") { } ~ReadAirQualityEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AirQuality::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AirQuality::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AirQuality.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AirQuality EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAirQualityEventList : public SubscribeAttribute { public: SubscribeAttributeAirQualityEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeAirQualityEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AirQuality::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AirQuality::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AirQuality.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadAirQualityAttributeList : public ReadAttribute { public: ReadAirQualityAttributeList() : ReadAttribute("attribute-list") { } ~ReadAirQualityAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AirQuality::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AirQuality::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AirQuality.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AirQuality AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAirQualityAttributeList : public SubscribeAttribute { public: SubscribeAttributeAirQualityAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeAirQualityAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AirQuality::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AirQuality::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AirQuality.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadAirQualityFeatureMap : public ReadAttribute { public: ReadAirQualityFeatureMap() : ReadAttribute("feature-map") { } ~ReadAirQualityFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AirQuality::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AirQuality::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AirQuality.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AirQuality FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAirQualityFeatureMap : public SubscribeAttribute { public: SubscribeAttributeAirQualityFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeAirQualityFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AirQuality::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AirQuality::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AirQuality.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadAirQualityClusterRevision : public ReadAttribute { public: ReadAirQualityClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadAirQualityClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AirQuality::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AirQuality::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AirQuality.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AirQuality ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAirQualityClusterRevision : public SubscribeAttribute { public: SubscribeAttributeAirQualityClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeAirQualityClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AirQuality::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AirQuality::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAirQuality alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AirQuality.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster SmokeCoAlarm | 0x005C | |------------------------------------------------------------------------------| | Commands: | | | * SelfTestRequest | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * ExpressedState | 0x0000 | | * SmokeState | 0x0001 | | * COState | 0x0002 | | * BatteryAlert | 0x0003 | | * DeviceMuted | 0x0004 | | * TestInProgress | 0x0005 | | * HardwareFaultAlert | 0x0006 | | * EndOfServiceAlert | 0x0007 | | * InterconnectSmokeAlarm | 0x0008 | | * InterconnectCOAlarm | 0x0009 | | * ContaminationState | 0x000A | | * SmokeSensitivityLevel | 0x000B | | * ExpiryDate | 0x000C | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * SmokeAlarm | 0x0000 | | * COAlarm | 0x0001 | | * LowBattery | 0x0002 | | * HardwareFault | 0x0003 | | * EndOfService | 0x0004 | | * SelfTestComplete | 0x0005 | | * AlarmMuted | 0x0006 | | * MuteEnded | 0x0007 | | * InterconnectSmokeAlarm | 0x0008 | | * InterconnectCOAlarm | 0x0009 | | * AllClear | 0x000A | \*----------------------------------------------------------------------------*/ /* * Command SelfTestRequest */ class SmokeCoAlarmSelfTestRequest : public ClusterCommand { public: SmokeCoAlarmSelfTestRequest() : ClusterCommand("self-test-request") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId commandId = chip::app::Clusters::SmokeCoAlarm::Commands::SelfTestRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSmokeCOAlarmClusterSelfTestRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster selfTestRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Attribute ExpressedState */ class ReadSmokeCoAlarmExpressedState : public ReadAttribute { public: ReadSmokeCoAlarmExpressedState() : ReadAttribute("expressed-state") { } ~ReadSmokeCoAlarmExpressedState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::ExpressedState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeExpressedStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.ExpressedState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm ExpressedState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmExpressedState : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmExpressedState() : SubscribeAttribute("expressed-state") { } ~SubscribeAttributeSmokeCoAlarmExpressedState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::ExpressedState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeExpressedStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.ExpressedState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SmokeState */ class ReadSmokeCoAlarmSmokeState : public ReadAttribute { public: ReadSmokeCoAlarmSmokeState() : ReadAttribute("smoke-state") { } ~ReadSmokeCoAlarmSmokeState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::SmokeState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSmokeStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.SmokeState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm SmokeState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmSmokeState : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmSmokeState() : SubscribeAttribute("smoke-state") { } ~SubscribeAttributeSmokeCoAlarmSmokeState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::SmokeState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSmokeStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.SmokeState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute COState */ class ReadSmokeCoAlarmCOState : public ReadAttribute { public: ReadSmokeCoAlarmCOState() : ReadAttribute("costate") { } ~ReadSmokeCoAlarmCOState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::COState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCOStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.COState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm COState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmCOState : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmCOState() : SubscribeAttribute("costate") { } ~SubscribeAttributeSmokeCoAlarmCOState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::COState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCOStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.COState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BatteryAlert */ class ReadSmokeCoAlarmBatteryAlert : public ReadAttribute { public: ReadSmokeCoAlarmBatteryAlert() : ReadAttribute("battery-alert") { } ~ReadSmokeCoAlarmBatteryAlert() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::BatteryAlert::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatteryAlertWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.BatteryAlert response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm BatteryAlert read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmBatteryAlert : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmBatteryAlert() : SubscribeAttribute("battery-alert") { } ~SubscribeAttributeSmokeCoAlarmBatteryAlert() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::BatteryAlert::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatteryAlertWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.BatteryAlert response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute DeviceMuted */ class ReadSmokeCoAlarmDeviceMuted : public ReadAttribute { public: ReadSmokeCoAlarmDeviceMuted() : ReadAttribute("device-muted") { } ~ReadSmokeCoAlarmDeviceMuted() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::DeviceMuted::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDeviceMutedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.DeviceMuted response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm DeviceMuted read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmDeviceMuted : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmDeviceMuted() : SubscribeAttribute("device-muted") { } ~SubscribeAttributeSmokeCoAlarmDeviceMuted() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::DeviceMuted::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDeviceMutedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.DeviceMuted response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TestInProgress */ class ReadSmokeCoAlarmTestInProgress : public ReadAttribute { public: ReadSmokeCoAlarmTestInProgress() : ReadAttribute("test-in-progress") { } ~ReadSmokeCoAlarmTestInProgress() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::TestInProgress::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTestInProgressWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.TestInProgress response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm TestInProgress read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmTestInProgress : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmTestInProgress() : SubscribeAttribute("test-in-progress") { } ~SubscribeAttributeSmokeCoAlarmTestInProgress() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::TestInProgress::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTestInProgressWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.TestInProgress response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute HardwareFaultAlert */ class ReadSmokeCoAlarmHardwareFaultAlert : public ReadAttribute { public: ReadSmokeCoAlarmHardwareFaultAlert() : ReadAttribute("hardware-fault-alert") { } ~ReadSmokeCoAlarmHardwareFaultAlert() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::HardwareFaultAlert::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeHardwareFaultAlertWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.HardwareFaultAlert response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm HardwareFaultAlert read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmHardwareFaultAlert : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmHardwareFaultAlert() : SubscribeAttribute("hardware-fault-alert") { } ~SubscribeAttributeSmokeCoAlarmHardwareFaultAlert() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::HardwareFaultAlert::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeHardwareFaultAlertWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.HardwareFaultAlert response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute EndOfServiceAlert */ class ReadSmokeCoAlarmEndOfServiceAlert : public ReadAttribute { public: ReadSmokeCoAlarmEndOfServiceAlert() : ReadAttribute("end-of-service-alert") { } ~ReadSmokeCoAlarmEndOfServiceAlert() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::EndOfServiceAlert::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEndOfServiceAlertWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.EndOfServiceAlert response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm EndOfServiceAlert read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmEndOfServiceAlert : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmEndOfServiceAlert() : SubscribeAttribute("end-of-service-alert") { } ~SubscribeAttributeSmokeCoAlarmEndOfServiceAlert() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::EndOfServiceAlert::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEndOfServiceAlertWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.EndOfServiceAlert response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute InterconnectSmokeAlarm */ class ReadSmokeCoAlarmInterconnectSmokeAlarm : public ReadAttribute { public: ReadSmokeCoAlarmInterconnectSmokeAlarm() : ReadAttribute("interconnect-smoke-alarm") { } ~ReadSmokeCoAlarmInterconnectSmokeAlarm() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::InterconnectSmokeAlarm::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInterconnectSmokeAlarmWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.InterconnectSmokeAlarm response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm InterconnectSmokeAlarm read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmInterconnectSmokeAlarm : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmInterconnectSmokeAlarm() : SubscribeAttribute("interconnect-smoke-alarm") { } ~SubscribeAttributeSmokeCoAlarmInterconnectSmokeAlarm() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::InterconnectSmokeAlarm::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInterconnectSmokeAlarmWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.InterconnectSmokeAlarm response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute InterconnectCOAlarm */ class ReadSmokeCoAlarmInterconnectCOAlarm : public ReadAttribute { public: ReadSmokeCoAlarmInterconnectCOAlarm() : ReadAttribute("interconnect-coalarm") { } ~ReadSmokeCoAlarmInterconnectCOAlarm() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::InterconnectCOAlarm::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInterconnectCOAlarmWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.InterconnectCOAlarm response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm InterconnectCOAlarm read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmInterconnectCOAlarm : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmInterconnectCOAlarm() : SubscribeAttribute("interconnect-coalarm") { } ~SubscribeAttributeSmokeCoAlarmInterconnectCOAlarm() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::InterconnectCOAlarm::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInterconnectCOAlarmWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.InterconnectCOAlarm response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ContaminationState */ class ReadSmokeCoAlarmContaminationState : public ReadAttribute { public: ReadSmokeCoAlarmContaminationState() : ReadAttribute("contamination-state") { } ~ReadSmokeCoAlarmContaminationState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::ContaminationState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeContaminationStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.ContaminationState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm ContaminationState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmContaminationState : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmContaminationState() : SubscribeAttribute("contamination-state") { } ~SubscribeAttributeSmokeCoAlarmContaminationState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::ContaminationState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeContaminationStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.ContaminationState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SmokeSensitivityLevel */ class ReadSmokeCoAlarmSmokeSensitivityLevel : public ReadAttribute { public: ReadSmokeCoAlarmSmokeSensitivityLevel() : ReadAttribute("smoke-sensitivity-level") { } ~ReadSmokeCoAlarmSmokeSensitivityLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::SmokeSensitivityLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSmokeSensitivityLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.SmokeSensitivityLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm SmokeSensitivityLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteSmokeCoAlarmSmokeSensitivityLevel : public WriteAttribute { public: WriteSmokeCoAlarmSmokeSensitivityLevel() : WriteAttribute("smoke-sensitivity-level") { AddArgument("attr-name", "smoke-sensitivity-level"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteSmokeCoAlarmSmokeSensitivityLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::SmokeSensitivityLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeSmokeSensitivityLevelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("SmokeCOAlarm SmokeSensitivityLevel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeSmokeCoAlarmSmokeSensitivityLevel : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmSmokeSensitivityLevel() : SubscribeAttribute("smoke-sensitivity-level") { } ~SubscribeAttributeSmokeCoAlarmSmokeSensitivityLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::SmokeSensitivityLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSmokeSensitivityLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.SmokeSensitivityLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ExpiryDate */ class ReadSmokeCoAlarmExpiryDate : public ReadAttribute { public: ReadSmokeCoAlarmExpiryDate() : ReadAttribute("expiry-date") { } ~ReadSmokeCoAlarmExpiryDate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::ExpiryDate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeExpiryDateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.ExpiryDate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm ExpiryDate read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmExpiryDate : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmExpiryDate() : SubscribeAttribute("expiry-date") { } ~SubscribeAttributeSmokeCoAlarmExpiryDate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::ExpiryDate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeExpiryDateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.ExpiryDate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadSmokeCoAlarmGeneratedCommandList : public ReadAttribute { public: ReadSmokeCoAlarmGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadSmokeCoAlarmGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeSmokeCoAlarmGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadSmokeCoAlarmAcceptedCommandList : public ReadAttribute { public: ReadSmokeCoAlarmAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadSmokeCoAlarmAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeSmokeCoAlarmAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadSmokeCoAlarmEventList : public ReadAttribute { public: ReadSmokeCoAlarmEventList() : ReadAttribute("event-list") { } ~ReadSmokeCoAlarmEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmEventList : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeSmokeCoAlarmEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadSmokeCoAlarmAttributeList : public ReadAttribute { public: ReadSmokeCoAlarmAttributeList() : ReadAttribute("attribute-list") { } ~ReadSmokeCoAlarmAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmAttributeList : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeSmokeCoAlarmAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadSmokeCoAlarmFeatureMap : public ReadAttribute { public: ReadSmokeCoAlarmFeatureMap() : ReadAttribute("feature-map") { } ~ReadSmokeCoAlarmFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmFeatureMap : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeSmokeCoAlarmFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadSmokeCoAlarmClusterRevision : public ReadAttribute { public: ReadSmokeCoAlarmClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadSmokeCoAlarmClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SmokeCOAlarm ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSmokeCoAlarmClusterRevision : public SubscribeAttribute { public: SubscribeAttributeSmokeCoAlarmClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeSmokeCoAlarmClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SmokeCoAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SmokeCoAlarm::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SmokeCOAlarm.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster DishwasherAlarm | 0x005D | |------------------------------------------------------------------------------| | Commands: | | | * Reset | 0x00 | | * ModifyEnabledAlarms | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | | * Mask | 0x0000 | | * Latch | 0x0001 | | * State | 0x0002 | | * Supported | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * Notify | 0x0000 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command Reset */ class DishwasherAlarmReset : public ClusterCommand { public: DishwasherAlarmReset() : ClusterCommand("reset") { #if MTR_ENABLE_PROVISIONAL AddArgument("Alarms", 0, UINT32_MAX, &mRequest.alarms); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DishwasherAlarm::Commands::Reset::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDishwasherAlarmClusterResetParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.alarms = [NSNumber numberWithUnsignedInt:mRequest.alarms.Raw()]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster resetWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DishwasherAlarm::Commands::Reset::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command ModifyEnabledAlarms */ class DishwasherAlarmModifyEnabledAlarms : public ClusterCommand { public: DishwasherAlarmModifyEnabledAlarms() : ClusterCommand("modify-enabled-alarms") { #if MTR_ENABLE_PROVISIONAL AddArgument("Mask", 0, UINT32_MAX, &mRequest.mask); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DishwasherAlarm::Commands::ModifyEnabledAlarms::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDishwasherAlarmClusterModifyEnabledAlarmsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.mask = [NSNumber numberWithUnsignedInt:mRequest.mask.Raw()]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster modifyEnabledAlarmsWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DishwasherAlarm::Commands::ModifyEnabledAlarms::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Mask */ class ReadDishwasherAlarmMask : public ReadAttribute { public: ReadDishwasherAlarmMask() : ReadAttribute("mask") { } ~ReadDishwasherAlarmMask() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::Mask::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaskWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.Mask response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherAlarm Mask read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherAlarmMask : public SubscribeAttribute { public: SubscribeAttributeDishwasherAlarmMask() : SubscribeAttribute("mask") { } ~SubscribeAttributeDishwasherAlarmMask() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::Mask::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaskWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.Mask response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Latch */ class ReadDishwasherAlarmLatch : public ReadAttribute { public: ReadDishwasherAlarmLatch() : ReadAttribute("latch") { } ~ReadDishwasherAlarmLatch() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::Latch::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLatchWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.Latch response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherAlarm Latch read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherAlarmLatch : public SubscribeAttribute { public: SubscribeAttributeDishwasherAlarmLatch() : SubscribeAttribute("latch") { } ~SubscribeAttributeDishwasherAlarmLatch() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::Latch::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLatchWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.Latch response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute State */ class ReadDishwasherAlarmState : public ReadAttribute { public: ReadDishwasherAlarmState() : ReadAttribute("state") { } ~ReadDishwasherAlarmState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::State::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.State response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherAlarm State read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherAlarmState : public SubscribeAttribute { public: SubscribeAttributeDishwasherAlarmState() : SubscribeAttribute("state") { } ~SubscribeAttributeDishwasherAlarmState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::State::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.State response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Supported */ class ReadDishwasherAlarmSupported : public ReadAttribute { public: ReadDishwasherAlarmSupported() : ReadAttribute("supported") { } ~ReadDishwasherAlarmSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::Supported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.Supported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherAlarm Supported read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherAlarmSupported : public SubscribeAttribute { public: SubscribeAttributeDishwasherAlarmSupported() : SubscribeAttribute("supported") { } ~SubscribeAttributeDishwasherAlarmSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::Supported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.Supported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadDishwasherAlarmGeneratedCommandList : public ReadAttribute { public: ReadDishwasherAlarmGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadDishwasherAlarmGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherAlarm GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherAlarmGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeDishwasherAlarmGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeDishwasherAlarmGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadDishwasherAlarmAcceptedCommandList : public ReadAttribute { public: ReadDishwasherAlarmAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadDishwasherAlarmAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherAlarm AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherAlarmAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeDishwasherAlarmAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeDishwasherAlarmAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadDishwasherAlarmEventList : public ReadAttribute { public: ReadDishwasherAlarmEventList() : ReadAttribute("event-list") { } ~ReadDishwasherAlarmEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherAlarm EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherAlarmEventList : public SubscribeAttribute { public: SubscribeAttributeDishwasherAlarmEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeDishwasherAlarmEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadDishwasherAlarmAttributeList : public ReadAttribute { public: ReadDishwasherAlarmAttributeList() : ReadAttribute("attribute-list") { } ~ReadDishwasherAlarmAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherAlarm AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherAlarmAttributeList : public SubscribeAttribute { public: SubscribeAttributeDishwasherAlarmAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeDishwasherAlarmAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadDishwasherAlarmFeatureMap : public ReadAttribute { public: ReadDishwasherAlarmFeatureMap() : ReadAttribute("feature-map") { } ~ReadDishwasherAlarmFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherAlarm FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherAlarmFeatureMap : public SubscribeAttribute { public: SubscribeAttributeDishwasherAlarmFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeDishwasherAlarmFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadDishwasherAlarmClusterRevision : public ReadAttribute { public: ReadDishwasherAlarmClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadDishwasherAlarmClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DishwasherAlarm ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDishwasherAlarmClusterRevision : public SubscribeAttribute { public: SubscribeAttributeDishwasherAlarmClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeDishwasherAlarmClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DishwasherAlarm::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DishwasherAlarm::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DishwasherAlarm.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster MicrowaveOvenMode | 0x005E | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * SupportedModes | 0x0000 | | * CurrentMode | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedModes */ class ReadMicrowaveOvenModeSupportedModes : public ReadAttribute { public: ReadMicrowaveOvenModeSupportedModes() : ReadAttribute("supported-modes") { } ~ReadMicrowaveOvenModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedModesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenMode SupportedModes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenModeSupportedModes : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenModeSupportedModes() : SubscribeAttribute("supported-modes") { } ~SubscribeAttributeMicrowaveOvenModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedModesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentMode */ class ReadMicrowaveOvenModeCurrentMode : public ReadAttribute { public: ReadMicrowaveOvenModeCurrentMode() : ReadAttribute("current-mode") { } ~ReadMicrowaveOvenModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenMode CurrentMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenModeCurrentMode : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenModeCurrentMode() : SubscribeAttribute("current-mode") { } ~SubscribeAttributeMicrowaveOvenModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadMicrowaveOvenModeGeneratedCommandList : public ReadAttribute { public: ReadMicrowaveOvenModeGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadMicrowaveOvenModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenMode GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenModeGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenModeGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeMicrowaveOvenModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadMicrowaveOvenModeAcceptedCommandList : public ReadAttribute { public: ReadMicrowaveOvenModeAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadMicrowaveOvenModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenMode AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenModeAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenModeAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeMicrowaveOvenModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadMicrowaveOvenModeEventList : public ReadAttribute { public: ReadMicrowaveOvenModeEventList() : ReadAttribute("event-list") { } ~ReadMicrowaveOvenModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenMode EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenModeEventList : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenModeEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeMicrowaveOvenModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadMicrowaveOvenModeAttributeList : public ReadAttribute { public: ReadMicrowaveOvenModeAttributeList() : ReadAttribute("attribute-list") { } ~ReadMicrowaveOvenModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenMode AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenModeAttributeList : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenModeAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeMicrowaveOvenModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadMicrowaveOvenModeFeatureMap : public ReadAttribute { public: ReadMicrowaveOvenModeFeatureMap() : ReadAttribute("feature-map") { } ~ReadMicrowaveOvenModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenMode FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenModeFeatureMap : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenModeFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeMicrowaveOvenModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadMicrowaveOvenModeClusterRevision : public ReadAttribute { public: ReadMicrowaveOvenModeClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadMicrowaveOvenModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenMode ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenModeClusterRevision : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenModeClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeMicrowaveOvenModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster MicrowaveOvenControl | 0x005F | |------------------------------------------------------------------------------| | Commands: | | | * SetCookingParameters | 0x00 | | * AddMoreTime | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | | * CookTime | 0x0000 | | * MaxCookTime | 0x0001 | | * PowerSetting | 0x0002 | | * MinPower | 0x0003 | | * MaxPower | 0x0004 | | * PowerStep | 0x0005 | | * SupportedWatts | 0x0006 | | * SelectedWattIndex | 0x0007 | | * WattRating | 0x0008 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command SetCookingParameters */ class MicrowaveOvenControlSetCookingParameters : public ClusterCommand { public: MicrowaveOvenControlSetCookingParameters() : ClusterCommand("set-cooking-parameters") { #if MTR_ENABLE_PROVISIONAL AddArgument("CookMode", 0, UINT8_MAX, &mRequest.cookMode); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("CookTime", 0, UINT32_MAX, &mRequest.cookTime); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("PowerSetting", 0, UINT8_MAX, &mRequest.powerSetting); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("WattSettingIndex", 0, UINT8_MAX, &mRequest.wattSettingIndex); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("StartAfterSetting", 0, 1, &mRequest.startAfterSetting); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MicrowaveOvenControl::Commands::SetCookingParameters::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMicrowaveOvenControlClusterSetCookingParametersParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.cookMode.HasValue()) { params.cookMode = [NSNumber numberWithUnsignedChar:mRequest.cookMode.Value()]; } else { params.cookMode = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.cookTime.HasValue()) { params.cookTime = [NSNumber numberWithUnsignedInt:mRequest.cookTime.Value()]; } else { params.cookTime = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.powerSetting.HasValue()) { params.powerSetting = [NSNumber numberWithUnsignedChar:mRequest.powerSetting.Value()]; } else { params.powerSetting = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.wattSettingIndex.HasValue()) { params.wattSettingIndex = [NSNumber numberWithUnsignedChar:mRequest.wattSettingIndex.Value()]; } else { params.wattSettingIndex = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.startAfterSetting.HasValue()) { params.startAfterSetting = [NSNumber numberWithBool:mRequest.startAfterSetting.Value()]; } else { params.startAfterSetting = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setCookingParametersWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::MicrowaveOvenControl::Commands::SetCookingParameters::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command AddMoreTime */ class MicrowaveOvenControlAddMoreTime : public ClusterCommand { public: MicrowaveOvenControlAddMoreTime() : ClusterCommand("add-more-time") { #if MTR_ENABLE_PROVISIONAL AddArgument("TimeToAdd", 0, UINT32_MAX, &mRequest.timeToAdd); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MicrowaveOvenControl::Commands::AddMoreTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMicrowaveOvenControlClusterAddMoreTimeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.timeToAdd = [NSNumber numberWithUnsignedInt:mRequest.timeToAdd]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster addMoreTimeWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::MicrowaveOvenControl::Commands::AddMoreTime::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CookTime */ class ReadMicrowaveOvenControlCookTime : public ReadAttribute { public: ReadMicrowaveOvenControlCookTime() : ReadAttribute("cook-time") { } ~ReadMicrowaveOvenControlCookTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::CookTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCookTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.CookTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenControl CookTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenControlCookTime : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenControlCookTime() : SubscribeAttribute("cook-time") { } ~SubscribeAttributeMicrowaveOvenControlCookTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::CookTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCookTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.CookTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MaxCookTime */ class ReadMicrowaveOvenControlMaxCookTime : public ReadAttribute { public: ReadMicrowaveOvenControlMaxCookTime() : ReadAttribute("max-cook-time") { } ~ReadMicrowaveOvenControlMaxCookTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::MaxCookTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxCookTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.MaxCookTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenControl MaxCookTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenControlMaxCookTime : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenControlMaxCookTime() : SubscribeAttribute("max-cook-time") { } ~SubscribeAttributeMicrowaveOvenControlMaxCookTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::MaxCookTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxCookTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.MaxCookTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute PowerSetting */ class ReadMicrowaveOvenControlPowerSetting : public ReadAttribute { public: ReadMicrowaveOvenControlPowerSetting() : ReadAttribute("power-setting") { } ~ReadMicrowaveOvenControlPowerSetting() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::PowerSetting::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePowerSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.PowerSetting response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenControl PowerSetting read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenControlPowerSetting : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenControlPowerSetting() : SubscribeAttribute("power-setting") { } ~SubscribeAttributeMicrowaveOvenControlPowerSetting() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::PowerSetting::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePowerSettingWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.PowerSetting response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MinPower */ class ReadMicrowaveOvenControlMinPower : public ReadAttribute { public: ReadMicrowaveOvenControlMinPower() : ReadAttribute("min-power") { } ~ReadMicrowaveOvenControlMinPower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::MinPower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinPowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.MinPower response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenControl MinPower read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenControlMinPower : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenControlMinPower() : SubscribeAttribute("min-power") { } ~SubscribeAttributeMicrowaveOvenControlMinPower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::MinPower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinPowerWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.MinPower response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MaxPower */ class ReadMicrowaveOvenControlMaxPower : public ReadAttribute { public: ReadMicrowaveOvenControlMaxPower() : ReadAttribute("max-power") { } ~ReadMicrowaveOvenControlMaxPower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::MaxPower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxPowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.MaxPower response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenControl MaxPower read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenControlMaxPower : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenControlMaxPower() : SubscribeAttribute("max-power") { } ~SubscribeAttributeMicrowaveOvenControlMaxPower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::MaxPower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxPowerWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.MaxPower response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute PowerStep */ class ReadMicrowaveOvenControlPowerStep : public ReadAttribute { public: ReadMicrowaveOvenControlPowerStep() : ReadAttribute("power-step") { } ~ReadMicrowaveOvenControlPowerStep() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::PowerStep::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePowerStepWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.PowerStep response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenControl PowerStep read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenControlPowerStep : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenControlPowerStep() : SubscribeAttribute("power-step") { } ~SubscribeAttributeMicrowaveOvenControlPowerStep() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::PowerStep::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePowerStepWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.PowerStep response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedWatts */ class ReadMicrowaveOvenControlSupportedWatts : public ReadAttribute { public: ReadMicrowaveOvenControlSupportedWatts() : ReadAttribute("supported-watts") { } ~ReadMicrowaveOvenControlSupportedWatts() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::SupportedWatts::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedWattsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.SupportedWatts response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenControl SupportedWatts read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenControlSupportedWatts : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenControlSupportedWatts() : SubscribeAttribute("supported-watts") { } ~SubscribeAttributeMicrowaveOvenControlSupportedWatts() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::SupportedWatts::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedWattsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.SupportedWatts response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SelectedWattIndex */ class ReadMicrowaveOvenControlSelectedWattIndex : public ReadAttribute { public: ReadMicrowaveOvenControlSelectedWattIndex() : ReadAttribute("selected-watt-index") { } ~ReadMicrowaveOvenControlSelectedWattIndex() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::SelectedWattIndex::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSelectedWattIndexWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.SelectedWattIndex response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenControl SelectedWattIndex read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenControlSelectedWattIndex : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenControlSelectedWattIndex() : SubscribeAttribute("selected-watt-index") { } ~SubscribeAttributeMicrowaveOvenControlSelectedWattIndex() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::SelectedWattIndex::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSelectedWattIndexWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.SelectedWattIndex response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute WattRating */ class ReadMicrowaveOvenControlWattRating : public ReadAttribute { public: ReadMicrowaveOvenControlWattRating() : ReadAttribute("watt-rating") { } ~ReadMicrowaveOvenControlWattRating() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::WattRating::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWattRatingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.WattRating response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenControl WattRating read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenControlWattRating : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenControlWattRating() : SubscribeAttribute("watt-rating") { } ~SubscribeAttributeMicrowaveOvenControlWattRating() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::WattRating::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWattRatingWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.WattRating response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadMicrowaveOvenControlGeneratedCommandList : public ReadAttribute { public: ReadMicrowaveOvenControlGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadMicrowaveOvenControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenControl GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenControlGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenControlGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeMicrowaveOvenControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadMicrowaveOvenControlAcceptedCommandList : public ReadAttribute { public: ReadMicrowaveOvenControlAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadMicrowaveOvenControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenControl AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenControlAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenControlAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeMicrowaveOvenControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadMicrowaveOvenControlEventList : public ReadAttribute { public: ReadMicrowaveOvenControlEventList() : ReadAttribute("event-list") { } ~ReadMicrowaveOvenControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenControl EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenControlEventList : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenControlEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeMicrowaveOvenControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadMicrowaveOvenControlAttributeList : public ReadAttribute { public: ReadMicrowaveOvenControlAttributeList() : ReadAttribute("attribute-list") { } ~ReadMicrowaveOvenControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenControl AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenControlAttributeList : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenControlAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeMicrowaveOvenControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadMicrowaveOvenControlFeatureMap : public ReadAttribute { public: ReadMicrowaveOvenControlFeatureMap() : ReadAttribute("feature-map") { } ~ReadMicrowaveOvenControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenControl FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenControlFeatureMap : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenControlFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeMicrowaveOvenControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadMicrowaveOvenControlClusterRevision : public ReadAttribute { public: ReadMicrowaveOvenControlClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadMicrowaveOvenControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MicrowaveOvenControl ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMicrowaveOvenControlClusterRevision : public SubscribeAttribute { public: SubscribeAttributeMicrowaveOvenControlClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeMicrowaveOvenControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MicrowaveOvenControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MicrowaveOvenControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMicrowaveOvenControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MicrowaveOvenControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster OperationalState | 0x0060 | |------------------------------------------------------------------------------| | Commands: | | | * Pause | 0x00 | | * Stop | 0x01 | | * Start | 0x02 | | * Resume | 0x03 | |------------------------------------------------------------------------------| | Attributes: | | | * PhaseList | 0x0000 | | * CurrentPhase | 0x0001 | | * CountdownTime | 0x0002 | | * OperationalStateList | 0x0003 | | * OperationalState | 0x0004 | | * OperationalError | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * OperationalError | 0x0000 | | * OperationCompletion | 0x0001 | \*----------------------------------------------------------------------------*/ /* * Command Pause */ class OperationalStatePause : public ClusterCommand { public: OperationalStatePause() : ClusterCommand("pause") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OperationalState::Commands::Pause::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROperationalStateClusterPauseParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster pauseWithParams:params completion: ^(MTROperationalStateClusterOperationalCommandResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command Stop */ class OperationalStateStop : public ClusterCommand { public: OperationalStateStop() : ClusterCommand("stop") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OperationalState::Commands::Stop::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROperationalStateClusterStopParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stopWithParams:params completion: ^(MTROperationalStateClusterOperationalCommandResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command Start */ class OperationalStateStart : public ClusterCommand { public: OperationalStateStart() : ClusterCommand("start") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OperationalState::Commands::Start::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROperationalStateClusterStartParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster startWithParams:params completion: ^(MTROperationalStateClusterOperationalCommandResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command Resume */ class OperationalStateResume : public ClusterCommand { public: OperationalStateResume() : ClusterCommand("resume") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::CommandId commandId = chip::app::Clusters::OperationalState::Commands::Resume::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTROperationalStateClusterResumeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster resumeWithParams:params completion: ^(MTROperationalStateClusterOperationalCommandResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::OperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::OperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Attribute PhaseList */ class ReadOperationalStatePhaseList : public ReadAttribute { public: ReadOperationalStatePhaseList() : ReadAttribute("phase-list") { } ~ReadOperationalStatePhaseList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalState::Attributes::PhaseList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePhaseListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.PhaseList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalState PhaseList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalStatePhaseList : public SubscribeAttribute { public: SubscribeAttributeOperationalStatePhaseList() : SubscribeAttribute("phase-list") { } ~SubscribeAttributeOperationalStatePhaseList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalState::Attributes::PhaseList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePhaseListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.PhaseList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentPhase */ class ReadOperationalStateCurrentPhase : public ReadAttribute { public: ReadOperationalStateCurrentPhase() : ReadAttribute("current-phase") { } ~ReadOperationalStateCurrentPhase() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalState::Attributes::CurrentPhase::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentPhaseWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.CurrentPhase response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalState CurrentPhase read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalStateCurrentPhase : public SubscribeAttribute { public: SubscribeAttributeOperationalStateCurrentPhase() : SubscribeAttribute("current-phase") { } ~SubscribeAttributeOperationalStateCurrentPhase() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalState::Attributes::CurrentPhase::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentPhaseWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.CurrentPhase response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CountdownTime */ class ReadOperationalStateCountdownTime : public ReadAttribute { public: ReadOperationalStateCountdownTime() : ReadAttribute("countdown-time") { } ~ReadOperationalStateCountdownTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalState::Attributes::CountdownTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCountdownTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.CountdownTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalState CountdownTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalStateCountdownTime : public SubscribeAttribute { public: SubscribeAttributeOperationalStateCountdownTime() : SubscribeAttribute("countdown-time") { } ~SubscribeAttributeOperationalStateCountdownTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalState::Attributes::CountdownTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCountdownTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.CountdownTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OperationalStateList */ class ReadOperationalStateOperationalStateList : public ReadAttribute { public: ReadOperationalStateOperationalStateList() : ReadAttribute("operational-state-list") { } ~ReadOperationalStateOperationalStateList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalState::Attributes::OperationalStateList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOperationalStateListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.OperationalStateList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalState OperationalStateList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalStateOperationalStateList : public SubscribeAttribute { public: SubscribeAttributeOperationalStateOperationalStateList() : SubscribeAttribute("operational-state-list") { } ~SubscribeAttributeOperationalStateOperationalStateList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalState::Attributes::OperationalStateList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOperationalStateListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.OperationalStateList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OperationalState */ class ReadOperationalStateOperationalState : public ReadAttribute { public: ReadOperationalStateOperationalState() : ReadAttribute("operational-state") { } ~ReadOperationalStateOperationalState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalState::Attributes::OperationalState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOperationalStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.OperationalState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalState OperationalState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalStateOperationalState : public SubscribeAttribute { public: SubscribeAttributeOperationalStateOperationalState() : SubscribeAttribute("operational-state") { } ~SubscribeAttributeOperationalStateOperationalState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalState::Attributes::OperationalState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOperationalStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.OperationalState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OperationalError */ class ReadOperationalStateOperationalError : public ReadAttribute { public: ReadOperationalStateOperationalError() : ReadAttribute("operational-error") { } ~ReadOperationalStateOperationalError() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalState::Attributes::OperationalError::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOperationalErrorWithCompletion:^(MTROperationalStateClusterErrorStateStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.OperationalError response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalState OperationalError read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalStateOperationalError : public SubscribeAttribute { public: SubscribeAttributeOperationalStateOperationalError() : SubscribeAttribute("operational-error") { } ~SubscribeAttributeOperationalStateOperationalError() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalState::Attributes::OperationalError::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOperationalErrorWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTROperationalStateClusterErrorStateStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.OperationalError response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadOperationalStateGeneratedCommandList : public ReadAttribute { public: ReadOperationalStateGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadOperationalStateGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalState::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalState GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalStateGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeOperationalStateGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeOperationalStateGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalState::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadOperationalStateAcceptedCommandList : public ReadAttribute { public: ReadOperationalStateAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadOperationalStateAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalState::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalState AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalStateAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeOperationalStateAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeOperationalStateAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalState::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadOperationalStateEventList : public ReadAttribute { public: ReadOperationalStateEventList() : ReadAttribute("event-list") { } ~ReadOperationalStateEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalState::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalState EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalStateEventList : public SubscribeAttribute { public: SubscribeAttributeOperationalStateEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeOperationalStateEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalState::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadOperationalStateAttributeList : public ReadAttribute { public: ReadOperationalStateAttributeList() : ReadAttribute("attribute-list") { } ~ReadOperationalStateAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalState::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalState AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalStateAttributeList : public SubscribeAttribute { public: SubscribeAttributeOperationalStateAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeOperationalStateAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalState::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadOperationalStateFeatureMap : public ReadAttribute { public: ReadOperationalStateFeatureMap() : ReadAttribute("feature-map") { } ~ReadOperationalStateFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalState::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalState FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalStateFeatureMap : public SubscribeAttribute { public: SubscribeAttributeOperationalStateFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeOperationalStateFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalState::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadOperationalStateClusterRevision : public ReadAttribute { public: ReadOperationalStateClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadOperationalStateClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OperationalState::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OperationalState ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOperationalStateClusterRevision : public SubscribeAttribute { public: SubscribeAttributeOperationalStateClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeOperationalStateClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OperationalState::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalState.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster RvcOperationalState | 0x0061 | |------------------------------------------------------------------------------| | Commands: | | | * Pause | 0x00 | | * Resume | 0x03 | | * GoHome | 0x80 | |------------------------------------------------------------------------------| | Attributes: | | | * PhaseList | 0x0000 | | * CurrentPhase | 0x0001 | | * CountdownTime | 0x0002 | | * OperationalStateList | 0x0003 | | * OperationalState | 0x0004 | | * OperationalError | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * OperationalError | 0x0000 | | * OperationCompletion | 0x0001 | \*----------------------------------------------------------------------------*/ /* * Command Pause */ class RvcOperationalStatePause : public ClusterCommand { public: RvcOperationalStatePause() : ClusterCommand("pause") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::CommandId commandId = chip::app::Clusters::RvcOperationalState::Commands::Pause::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRRVCOperationalStateClusterPauseParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster pauseWithParams:params completion: ^(MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::RvcOperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::RvcOperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command Resume */ class RvcOperationalStateResume : public ClusterCommand { public: RvcOperationalStateResume() : ClusterCommand("resume") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::CommandId commandId = chip::app::Clusters::RvcOperationalState::Commands::Resume::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRRVCOperationalStateClusterResumeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster resumeWithParams:params completion: ^(MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::RvcOperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::RvcOperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #if MTR_ENABLE_PROVISIONAL /* * Command GoHome */ class RvcOperationalStateGoHome : public ClusterCommand { public: RvcOperationalStateGoHome() : ClusterCommand("go-home") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::CommandId commandId = chip::app::Clusters::RvcOperationalState::Commands::GoHome::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRRVCOperationalStateClusterGoHomeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster goHomeWithParams:params completion: ^(MTRRVCOperationalStateClusterOperationalCommandResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::RvcOperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::RvcOperationalState::Commands::OperationalCommandResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute PhaseList */ class ReadRvcOperationalStatePhaseList : public ReadAttribute { public: ReadRvcOperationalStatePhaseList() : ReadAttribute("phase-list") { } ~ReadRvcOperationalStatePhaseList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::PhaseList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePhaseListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.PhaseList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCOperationalState PhaseList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcOperationalStatePhaseList : public SubscribeAttribute { public: SubscribeAttributeRvcOperationalStatePhaseList() : SubscribeAttribute("phase-list") { } ~SubscribeAttributeRvcOperationalStatePhaseList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::PhaseList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePhaseListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.PhaseList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentPhase */ class ReadRvcOperationalStateCurrentPhase : public ReadAttribute { public: ReadRvcOperationalStateCurrentPhase() : ReadAttribute("current-phase") { } ~ReadRvcOperationalStateCurrentPhase() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::CurrentPhase::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentPhaseWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.CurrentPhase response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCOperationalState CurrentPhase read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcOperationalStateCurrentPhase : public SubscribeAttribute { public: SubscribeAttributeRvcOperationalStateCurrentPhase() : SubscribeAttribute("current-phase") { } ~SubscribeAttributeRvcOperationalStateCurrentPhase() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::CurrentPhase::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentPhaseWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.CurrentPhase response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CountdownTime */ class ReadRvcOperationalStateCountdownTime : public ReadAttribute { public: ReadRvcOperationalStateCountdownTime() : ReadAttribute("countdown-time") { } ~ReadRvcOperationalStateCountdownTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::CountdownTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCountdownTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.CountdownTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCOperationalState CountdownTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcOperationalStateCountdownTime : public SubscribeAttribute { public: SubscribeAttributeRvcOperationalStateCountdownTime() : SubscribeAttribute("countdown-time") { } ~SubscribeAttributeRvcOperationalStateCountdownTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::CountdownTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCountdownTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.CountdownTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OperationalStateList */ class ReadRvcOperationalStateOperationalStateList : public ReadAttribute { public: ReadRvcOperationalStateOperationalStateList() : ReadAttribute("operational-state-list") { } ~ReadRvcOperationalStateOperationalStateList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::OperationalStateList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOperationalStateListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.OperationalStateList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCOperationalState OperationalStateList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcOperationalStateOperationalStateList : public SubscribeAttribute { public: SubscribeAttributeRvcOperationalStateOperationalStateList() : SubscribeAttribute("operational-state-list") { } ~SubscribeAttributeRvcOperationalStateOperationalStateList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::OperationalStateList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOperationalStateListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.OperationalStateList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OperationalState */ class ReadRvcOperationalStateOperationalState : public ReadAttribute { public: ReadRvcOperationalStateOperationalState() : ReadAttribute("operational-state") { } ~ReadRvcOperationalStateOperationalState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::OperationalState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOperationalStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.OperationalState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCOperationalState OperationalState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcOperationalStateOperationalState : public SubscribeAttribute { public: SubscribeAttributeRvcOperationalStateOperationalState() : SubscribeAttribute("operational-state") { } ~SubscribeAttributeRvcOperationalStateOperationalState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::OperationalState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOperationalStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.OperationalState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OperationalError */ class ReadRvcOperationalStateOperationalError : public ReadAttribute { public: ReadRvcOperationalStateOperationalError() : ReadAttribute("operational-error") { } ~ReadRvcOperationalStateOperationalError() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::OperationalError::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOperationalErrorWithCompletion:^(MTRRVCOperationalStateClusterErrorStateStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.OperationalError response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCOperationalState OperationalError read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcOperationalStateOperationalError : public SubscribeAttribute { public: SubscribeAttributeRvcOperationalStateOperationalError() : SubscribeAttribute("operational-error") { } ~SubscribeAttributeRvcOperationalStateOperationalError() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::OperationalError::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOperationalErrorWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRRVCOperationalStateClusterErrorStateStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.OperationalError response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadRvcOperationalStateGeneratedCommandList : public ReadAttribute { public: ReadRvcOperationalStateGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadRvcOperationalStateGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCOperationalState GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcOperationalStateGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeRvcOperationalStateGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeRvcOperationalStateGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadRvcOperationalStateAcceptedCommandList : public ReadAttribute { public: ReadRvcOperationalStateAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadRvcOperationalStateAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCOperationalState AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcOperationalStateAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeRvcOperationalStateAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeRvcOperationalStateAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadRvcOperationalStateEventList : public ReadAttribute { public: ReadRvcOperationalStateEventList() : ReadAttribute("event-list") { } ~ReadRvcOperationalStateEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCOperationalState EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcOperationalStateEventList : public SubscribeAttribute { public: SubscribeAttributeRvcOperationalStateEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeRvcOperationalStateEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadRvcOperationalStateAttributeList : public ReadAttribute { public: ReadRvcOperationalStateAttributeList() : ReadAttribute("attribute-list") { } ~ReadRvcOperationalStateAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCOperationalState AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcOperationalStateAttributeList : public SubscribeAttribute { public: SubscribeAttributeRvcOperationalStateAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeRvcOperationalStateAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadRvcOperationalStateFeatureMap : public ReadAttribute { public: ReadRvcOperationalStateFeatureMap() : ReadAttribute("feature-map") { } ~ReadRvcOperationalStateFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCOperationalState FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcOperationalStateFeatureMap : public SubscribeAttribute { public: SubscribeAttributeRvcOperationalStateFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeRvcOperationalStateFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadRvcOperationalStateClusterRevision : public ReadAttribute { public: ReadRvcOperationalStateClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadRvcOperationalStateClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RVCOperationalState ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRvcOperationalStateClusterRevision : public SubscribeAttribute { public: SubscribeAttributeRvcOperationalStateClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeRvcOperationalStateClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RvcOperationalState::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RvcOperationalState::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RVCOperationalState.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster ScenesManagement | 0x0062 | |------------------------------------------------------------------------------| | Commands: | | | * AddScene | 0x00 | | * ViewScene | 0x01 | | * RemoveScene | 0x02 | | * RemoveAllScenes | 0x03 | | * StoreScene | 0x04 | | * RecallScene | 0x05 | | * GetSceneMembership | 0x06 | | * CopyScene | 0x40 | |------------------------------------------------------------------------------| | Attributes: | | | * LastConfiguredBy | 0x0000 | | * SceneTableSize | 0x0001 | | * FabricSceneInfo | 0x0002 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command AddScene */ class ScenesManagementAddScene : public ClusterCommand { public: ScenesManagementAddScene() : ClusterCommand("add-scene") , mComplex_ExtensionFieldSets(&mRequest.extensionFieldSets) { #if MTR_ENABLE_PROVISIONAL AddArgument("GroupID", 0, UINT16_MAX, &mRequest.groupID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("SceneID", 0, UINT8_MAX, &mRequest.sceneID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("TransitionTime", 0, UINT32_MAX, &mRequest.transitionTime); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("SceneName", &mRequest.sceneName); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ExtensionFieldSets", &mComplex_ExtensionFieldSets); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ScenesManagement::Commands::AddScene::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRScenesManagementClusterAddSceneParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.groupID = [NSNumber numberWithUnsignedShort:mRequest.groupID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.sceneID = [NSNumber numberWithUnsignedChar:mRequest.sceneID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.transitionTime = [NSNumber numberWithUnsignedInt:mRequest.transitionTime]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.sceneName = [[NSString alloc] initWithBytes:mRequest.sceneName.data() length:mRequest.sceneName.size() encoding:NSUTF8StringEncoding]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.extensionFieldSets) { MTRScenesManagementClusterExtensionFieldSet * newElement_0; newElement_0 = [MTRScenesManagementClusterExtensionFieldSet new]; newElement_0.clusterID = [NSNumber numberWithUnsignedInt:entry_0.clusterID]; { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.attributeValueList) { MTRScenesManagementClusterAttributeValuePairStruct * newElement_2; newElement_2 = [MTRScenesManagementClusterAttributeValuePairStruct new]; newElement_2.attributeID = [NSNumber numberWithUnsignedInt:entry_2.attributeID]; if (entry_2.valueUnsigned8.HasValue()) { newElement_2.valueUnsigned8 = [NSNumber numberWithUnsignedChar:entry_2.valueUnsigned8.Value()]; } else { newElement_2.valueUnsigned8 = nil; } if (entry_2.valueSigned8.HasValue()) { newElement_2.valueSigned8 = [NSNumber numberWithChar:entry_2.valueSigned8.Value()]; } else { newElement_2.valueSigned8 = nil; } if (entry_2.valueUnsigned16.HasValue()) { newElement_2.valueUnsigned16 = [NSNumber numberWithUnsignedShort:entry_2.valueUnsigned16.Value()]; } else { newElement_2.valueUnsigned16 = nil; } if (entry_2.valueSigned16.HasValue()) { newElement_2.valueSigned16 = [NSNumber numberWithShort:entry_2.valueSigned16.Value()]; } else { newElement_2.valueSigned16 = nil; } if (entry_2.valueUnsigned32.HasValue()) { newElement_2.valueUnsigned32 = [NSNumber numberWithUnsignedInt:entry_2.valueUnsigned32.Value()]; } else { newElement_2.valueUnsigned32 = nil; } if (entry_2.valueSigned32.HasValue()) { newElement_2.valueSigned32 = [NSNumber numberWithInt:entry_2.valueSigned32.Value()]; } else { newElement_2.valueSigned32 = nil; } if (entry_2.valueUnsigned64.HasValue()) { newElement_2.valueUnsigned64 = [NSNumber numberWithUnsignedLongLong:entry_2.valueUnsigned64.Value()]; } else { newElement_2.valueUnsigned64 = nil; } if (entry_2.valueSigned64.HasValue()) { newElement_2.valueSigned64 = [NSNumber numberWithLongLong:entry_2.valueSigned64.Value()]; } else { newElement_2.valueSigned64 = nil; } [array_2 addObject:newElement_2]; } newElement_0.attributeValueList = array_2; } [array_0 addObject:newElement_0]; } params.extensionFieldSets = array_0; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster addSceneWithParams:params completion: ^(MTRScenesManagementClusterAddSceneResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ScenesManagement::Commands::AddSceneResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ScenesManagement::Commands::AddSceneResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ScenesManagement::Commands::AddScene::Type mRequest; TypedComplexArgument> mComplex_ExtensionFieldSets; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command ViewScene */ class ScenesManagementViewScene : public ClusterCommand { public: ScenesManagementViewScene() : ClusterCommand("view-scene") { #if MTR_ENABLE_PROVISIONAL AddArgument("GroupID", 0, UINT16_MAX, &mRequest.groupID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("SceneID", 0, UINT8_MAX, &mRequest.sceneID); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ScenesManagement::Commands::ViewScene::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRScenesManagementClusterViewSceneParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.groupID = [NSNumber numberWithUnsignedShort:mRequest.groupID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.sceneID = [NSNumber numberWithUnsignedChar:mRequest.sceneID]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster viewSceneWithParams:params completion: ^(MTRScenesManagementClusterViewSceneResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ScenesManagement::Commands::ViewSceneResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ScenesManagement::Commands::ViewSceneResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ScenesManagement::Commands::ViewScene::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command RemoveScene */ class ScenesManagementRemoveScene : public ClusterCommand { public: ScenesManagementRemoveScene() : ClusterCommand("remove-scene") { #if MTR_ENABLE_PROVISIONAL AddArgument("GroupID", 0, UINT16_MAX, &mRequest.groupID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("SceneID", 0, UINT8_MAX, &mRequest.sceneID); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ScenesManagement::Commands::RemoveScene::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRScenesManagementClusterRemoveSceneParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.groupID = [NSNumber numberWithUnsignedShort:mRequest.groupID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.sceneID = [NSNumber numberWithUnsignedChar:mRequest.sceneID]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster removeSceneWithParams:params completion: ^(MTRScenesManagementClusterRemoveSceneResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ScenesManagement::Commands::RemoveSceneResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ScenesManagement::Commands::RemoveSceneResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ScenesManagement::Commands::RemoveScene::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command RemoveAllScenes */ class ScenesManagementRemoveAllScenes : public ClusterCommand { public: ScenesManagementRemoveAllScenes() : ClusterCommand("remove-all-scenes") { #if MTR_ENABLE_PROVISIONAL AddArgument("GroupID", 0, UINT16_MAX, &mRequest.groupID); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ScenesManagement::Commands::RemoveAllScenes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRScenesManagementClusterRemoveAllScenesParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.groupID = [NSNumber numberWithUnsignedShort:mRequest.groupID]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster removeAllScenesWithParams:params completion: ^(MTRScenesManagementClusterRemoveAllScenesResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ScenesManagement::Commands::RemoveAllScenesResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ScenesManagement::Commands::RemoveAllScenesResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ScenesManagement::Commands::RemoveAllScenes::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command StoreScene */ class ScenesManagementStoreScene : public ClusterCommand { public: ScenesManagementStoreScene() : ClusterCommand("store-scene") { #if MTR_ENABLE_PROVISIONAL AddArgument("GroupID", 0, UINT16_MAX, &mRequest.groupID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("SceneID", 0, UINT8_MAX, &mRequest.sceneID); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ScenesManagement::Commands::StoreScene::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRScenesManagementClusterStoreSceneParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.groupID = [NSNumber numberWithUnsignedShort:mRequest.groupID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.sceneID = [NSNumber numberWithUnsignedChar:mRequest.sceneID]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster storeSceneWithParams:params completion: ^(MTRScenesManagementClusterStoreSceneResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ScenesManagement::Commands::StoreSceneResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ScenesManagement::Commands::StoreSceneResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ScenesManagement::Commands::StoreScene::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command RecallScene */ class ScenesManagementRecallScene : public ClusterCommand { public: ScenesManagementRecallScene() : ClusterCommand("recall-scene") { #if MTR_ENABLE_PROVISIONAL AddArgument("GroupID", 0, UINT16_MAX, &mRequest.groupID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("SceneID", 0, UINT8_MAX, &mRequest.sceneID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("TransitionTime", 0, UINT32_MAX, &mRequest.transitionTime); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ScenesManagement::Commands::RecallScene::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRScenesManagementClusterRecallSceneParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.groupID = [NSNumber numberWithUnsignedShort:mRequest.groupID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.sceneID = [NSNumber numberWithUnsignedChar:mRequest.sceneID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.transitionTime.HasValue()) { if (mRequest.transitionTime.Value().IsNull()) { params.transitionTime = nil; } else { params.transitionTime = [NSNumber numberWithUnsignedInt:mRequest.transitionTime.Value().Value()]; } } else { params.transitionTime = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster recallSceneWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ScenesManagement::Commands::RecallScene::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command GetSceneMembership */ class ScenesManagementGetSceneMembership : public ClusterCommand { public: ScenesManagementGetSceneMembership() : ClusterCommand("get-scene-membership") { #if MTR_ENABLE_PROVISIONAL AddArgument("GroupID", 0, UINT16_MAX, &mRequest.groupID); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ScenesManagement::Commands::GetSceneMembership::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRScenesManagementClusterGetSceneMembershipParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.groupID = [NSNumber numberWithUnsignedShort:mRequest.groupID]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster getSceneMembershipWithParams:params completion: ^(MTRScenesManagementClusterGetSceneMembershipResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ScenesManagement::Commands::GetSceneMembershipResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ScenesManagement::Commands::GetSceneMembershipResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ScenesManagement::Commands::GetSceneMembership::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command CopyScene */ class ScenesManagementCopyScene : public ClusterCommand { public: ScenesManagementCopyScene() : ClusterCommand("copy-scene") { #if MTR_ENABLE_PROVISIONAL AddArgument("Mode", 0, UINT8_MAX, &mRequest.mode); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("GroupIdentifierFrom", 0, UINT16_MAX, &mRequest.groupIdentifierFrom); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("SceneIdentifierFrom", 0, UINT8_MAX, &mRequest.sceneIdentifierFrom); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("GroupIdentifierTo", 0, UINT16_MAX, &mRequest.groupIdentifierTo); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("SceneIdentifierTo", 0, UINT8_MAX, &mRequest.sceneIdentifierTo); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ScenesManagement::Commands::CopyScene::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRScenesManagementClusterCopySceneParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.mode = [NSNumber numberWithUnsignedChar:mRequest.mode.Raw()]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.groupIdentifierFrom = [NSNumber numberWithUnsignedShort:mRequest.groupIdentifierFrom]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.sceneIdentifierFrom = [NSNumber numberWithUnsignedChar:mRequest.sceneIdentifierFrom]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.groupIdentifierTo = [NSNumber numberWithUnsignedShort:mRequest.groupIdentifierTo]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.sceneIdentifierTo = [NSNumber numberWithUnsignedChar:mRequest.sceneIdentifierTo]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster copySceneWithParams:params completion: ^(MTRScenesManagementClusterCopySceneResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ScenesManagement::Commands::CopySceneResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ScenesManagement::Commands::CopySceneResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ScenesManagement::Commands::CopyScene::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute LastConfiguredBy */ class ReadScenesManagementLastConfiguredBy : public ReadAttribute { public: ReadScenesManagementLastConfiguredBy() : ReadAttribute("last-configured-by") { } ~ReadScenesManagementLastConfiguredBy() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ScenesManagement::Attributes::LastConfiguredBy::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLastConfiguredByWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.LastConfiguredBy response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ScenesManagement LastConfiguredBy read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeScenesManagementLastConfiguredBy : public SubscribeAttribute { public: SubscribeAttributeScenesManagementLastConfiguredBy() : SubscribeAttribute("last-configured-by") { } ~SubscribeAttributeScenesManagementLastConfiguredBy() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ScenesManagement::Attributes::LastConfiguredBy::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLastConfiguredByWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.LastConfiguredBy response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SceneTableSize */ class ReadScenesManagementSceneTableSize : public ReadAttribute { public: ReadScenesManagementSceneTableSize() : ReadAttribute("scene-table-size") { } ~ReadScenesManagementSceneTableSize() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ScenesManagement::Attributes::SceneTableSize::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSceneTableSizeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.SceneTableSize response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ScenesManagement SceneTableSize read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeScenesManagementSceneTableSize : public SubscribeAttribute { public: SubscribeAttributeScenesManagementSceneTableSize() : SubscribeAttribute("scene-table-size") { } ~SubscribeAttributeScenesManagementSceneTableSize() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ScenesManagement::Attributes::SceneTableSize::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSceneTableSizeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.SceneTableSize response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FabricSceneInfo */ class ReadScenesManagementFabricSceneInfo : public ReadAttribute { public: ReadScenesManagementFabricSceneInfo() : ReadAttribute("fabric-scene-info") { } ~ReadScenesManagementFabricSceneInfo() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ScenesManagement::Attributes::FabricSceneInfo::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRReadParams alloc] init]; if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } [cluster readAttributeFabricSceneInfoWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.FabricSceneInfo response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ScenesManagement FabricSceneInfo read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeScenesManagementFabricSceneInfo : public SubscribeAttribute { public: SubscribeAttributeScenesManagementFabricSceneInfo() : SubscribeAttribute("fabric-scene-info") { } ~SubscribeAttributeScenesManagementFabricSceneInfo() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ScenesManagement::Attributes::FabricSceneInfo::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFabricSceneInfoWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.FabricSceneInfo response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadScenesManagementGeneratedCommandList : public ReadAttribute { public: ReadScenesManagementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadScenesManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ScenesManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ScenesManagement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeScenesManagementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeScenesManagementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeScenesManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ScenesManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadScenesManagementAcceptedCommandList : public ReadAttribute { public: ReadScenesManagementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadScenesManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ScenesManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ScenesManagement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeScenesManagementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeScenesManagementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeScenesManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ScenesManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadScenesManagementEventList : public ReadAttribute { public: ReadScenesManagementEventList() : ReadAttribute("event-list") { } ~ReadScenesManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ScenesManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ScenesManagement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeScenesManagementEventList : public SubscribeAttribute { public: SubscribeAttributeScenesManagementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeScenesManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ScenesManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadScenesManagementAttributeList : public ReadAttribute { public: ReadScenesManagementAttributeList() : ReadAttribute("attribute-list") { } ~ReadScenesManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ScenesManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ScenesManagement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeScenesManagementAttributeList : public SubscribeAttribute { public: SubscribeAttributeScenesManagementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeScenesManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ScenesManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadScenesManagementFeatureMap : public ReadAttribute { public: ReadScenesManagementFeatureMap() : ReadAttribute("feature-map") { } ~ReadScenesManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ScenesManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ScenesManagement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeScenesManagementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeScenesManagementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeScenesManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ScenesManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadScenesManagementClusterRevision : public ReadAttribute { public: ReadScenesManagementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadScenesManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ScenesManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ScenesManagement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeScenesManagementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeScenesManagementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeScenesManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ScenesManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ScenesManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterScenesManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ScenesManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster HepaFilterMonitoring | 0x0071 | |------------------------------------------------------------------------------| | Commands: | | | * ResetCondition | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * Condition | 0x0000 | | * DegradationDirection | 0x0001 | | * ChangeIndication | 0x0002 | | * InPlaceIndicator | 0x0003 | | * LastChangedTime | 0x0004 | | * ReplacementProductList | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command ResetCondition */ class HepaFilterMonitoringResetCondition : public ClusterCommand { public: HepaFilterMonitoringResetCondition() : ClusterCommand("reset-condition") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::CommandId commandId = chip::app::Clusters::HepaFilterMonitoring::Commands::ResetCondition::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRHEPAFilterMonitoringClusterResetConditionParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster resetConditionWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Attribute Condition */ class ReadHepaFilterMonitoringCondition : public ReadAttribute { public: ReadHepaFilterMonitoringCondition() : ReadAttribute("condition") { } ~ReadHepaFilterMonitoringCondition() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::Condition::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.Condition response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("HEPAFilterMonitoring Condition read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeHepaFilterMonitoringCondition : public SubscribeAttribute { public: SubscribeAttributeHepaFilterMonitoringCondition() : SubscribeAttribute("condition") { } ~SubscribeAttributeHepaFilterMonitoringCondition() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::Condition::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeConditionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.Condition response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute DegradationDirection */ class ReadHepaFilterMonitoringDegradationDirection : public ReadAttribute { public: ReadHepaFilterMonitoringDegradationDirection() : ReadAttribute("degradation-direction") { } ~ReadHepaFilterMonitoringDegradationDirection() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::DegradationDirection::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.DegradationDirection response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("HEPAFilterMonitoring DegradationDirection read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeHepaFilterMonitoringDegradationDirection : public SubscribeAttribute { public: SubscribeAttributeHepaFilterMonitoringDegradationDirection() : SubscribeAttribute("degradation-direction") { } ~SubscribeAttributeHepaFilterMonitoringDegradationDirection() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::DegradationDirection::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDegradationDirectionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.DegradationDirection response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ChangeIndication */ class ReadHepaFilterMonitoringChangeIndication : public ReadAttribute { public: ReadHepaFilterMonitoringChangeIndication() : ReadAttribute("change-indication") { } ~ReadHepaFilterMonitoringChangeIndication() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::ChangeIndication::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.ChangeIndication response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("HEPAFilterMonitoring ChangeIndication read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeHepaFilterMonitoringChangeIndication : public SubscribeAttribute { public: SubscribeAttributeHepaFilterMonitoringChangeIndication() : SubscribeAttribute("change-indication") { } ~SubscribeAttributeHepaFilterMonitoringChangeIndication() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::ChangeIndication::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeChangeIndicationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.ChangeIndication response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute InPlaceIndicator */ class ReadHepaFilterMonitoringInPlaceIndicator : public ReadAttribute { public: ReadHepaFilterMonitoringInPlaceIndicator() : ReadAttribute("in-place-indicator") { } ~ReadHepaFilterMonitoringInPlaceIndicator() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::InPlaceIndicator::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.InPlaceIndicator response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("HEPAFilterMonitoring InPlaceIndicator read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeHepaFilterMonitoringInPlaceIndicator : public SubscribeAttribute { public: SubscribeAttributeHepaFilterMonitoringInPlaceIndicator() : SubscribeAttribute("in-place-indicator") { } ~SubscribeAttributeHepaFilterMonitoringInPlaceIndicator() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::InPlaceIndicator::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInPlaceIndicatorWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.InPlaceIndicator response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LastChangedTime */ class ReadHepaFilterMonitoringLastChangedTime : public ReadAttribute { public: ReadHepaFilterMonitoringLastChangedTime() : ReadAttribute("last-changed-time") { } ~ReadHepaFilterMonitoringLastChangedTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::LastChangedTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLastChangedTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.LastChangedTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("HEPAFilterMonitoring LastChangedTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteHepaFilterMonitoringLastChangedTime : public WriteAttribute { public: WriteHepaFilterMonitoringLastChangedTime() : WriteAttribute("last-changed-time") { AddArgument("attr-name", "last-changed-time"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteHepaFilterMonitoringLastChangedTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::LastChangedTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedInt:mValue.Value()]; } [cluster writeAttributeLastChangedTimeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("HEPAFilterMonitoring LastChangedTime write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeHepaFilterMonitoringLastChangedTime : public SubscribeAttribute { public: SubscribeAttributeHepaFilterMonitoringLastChangedTime() : SubscribeAttribute("last-changed-time") { } ~SubscribeAttributeHepaFilterMonitoringLastChangedTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::LastChangedTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLastChangedTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.LastChangedTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ReplacementProductList */ class ReadHepaFilterMonitoringReplacementProductList : public ReadAttribute { public: ReadHepaFilterMonitoringReplacementProductList() : ReadAttribute("replacement-product-list") { } ~ReadHepaFilterMonitoringReplacementProductList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::ReplacementProductList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeReplacementProductListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.ReplacementProductList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("HEPAFilterMonitoring ReplacementProductList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeHepaFilterMonitoringReplacementProductList : public SubscribeAttribute { public: SubscribeAttributeHepaFilterMonitoringReplacementProductList() : SubscribeAttribute("replacement-product-list") { } ~SubscribeAttributeHepaFilterMonitoringReplacementProductList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::ReplacementProductList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeReplacementProductListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.ReplacementProductList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadHepaFilterMonitoringGeneratedCommandList : public ReadAttribute { public: ReadHepaFilterMonitoringGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadHepaFilterMonitoringGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("HEPAFilterMonitoring GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeHepaFilterMonitoringGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeHepaFilterMonitoringGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeHepaFilterMonitoringGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadHepaFilterMonitoringAcceptedCommandList : public ReadAttribute { public: ReadHepaFilterMonitoringAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadHepaFilterMonitoringAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("HEPAFilterMonitoring AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeHepaFilterMonitoringAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeHepaFilterMonitoringAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeHepaFilterMonitoringAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadHepaFilterMonitoringEventList : public ReadAttribute { public: ReadHepaFilterMonitoringEventList() : ReadAttribute("event-list") { } ~ReadHepaFilterMonitoringEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("HEPAFilterMonitoring EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeHepaFilterMonitoringEventList : public SubscribeAttribute { public: SubscribeAttributeHepaFilterMonitoringEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeHepaFilterMonitoringEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadHepaFilterMonitoringAttributeList : public ReadAttribute { public: ReadHepaFilterMonitoringAttributeList() : ReadAttribute("attribute-list") { } ~ReadHepaFilterMonitoringAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("HEPAFilterMonitoring AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeHepaFilterMonitoringAttributeList : public SubscribeAttribute { public: SubscribeAttributeHepaFilterMonitoringAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeHepaFilterMonitoringAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadHepaFilterMonitoringFeatureMap : public ReadAttribute { public: ReadHepaFilterMonitoringFeatureMap() : ReadAttribute("feature-map") { } ~ReadHepaFilterMonitoringFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("HEPAFilterMonitoring FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeHepaFilterMonitoringFeatureMap : public SubscribeAttribute { public: SubscribeAttributeHepaFilterMonitoringFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeHepaFilterMonitoringFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadHepaFilterMonitoringClusterRevision : public ReadAttribute { public: ReadHepaFilterMonitoringClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadHepaFilterMonitoringClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("HEPAFilterMonitoring ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeHepaFilterMonitoringClusterRevision : public SubscribeAttribute { public: SubscribeAttributeHepaFilterMonitoringClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeHepaFilterMonitoringClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::HepaFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::HepaFilterMonitoring::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"HEPAFilterMonitoring.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster ActivatedCarbonFilterMonitoring | 0x0072 | |------------------------------------------------------------------------------| | Commands: | | | * ResetCondition | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * Condition | 0x0000 | | * DegradationDirection | 0x0001 | | * ChangeIndication | 0x0002 | | * InPlaceIndicator | 0x0003 | | * LastChangedTime | 0x0004 | | * ReplacementProductList | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command ResetCondition */ class ActivatedCarbonFilterMonitoringResetCondition : public ClusterCommand { public: ActivatedCarbonFilterMonitoringResetCondition() : ClusterCommand("reset-condition") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Commands::ResetCondition::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRActivatedCarbonFilterMonitoringClusterResetConditionParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster resetConditionWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Attribute Condition */ class ReadActivatedCarbonFilterMonitoringCondition : public ReadAttribute { public: ReadActivatedCarbonFilterMonitoringCondition() : ReadAttribute("condition") { } ~ReadActivatedCarbonFilterMonitoringCondition() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::Condition::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.Condition response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ActivatedCarbonFilterMonitoring Condition read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActivatedCarbonFilterMonitoringCondition : public SubscribeAttribute { public: SubscribeAttributeActivatedCarbonFilterMonitoringCondition() : SubscribeAttribute("condition") { } ~SubscribeAttributeActivatedCarbonFilterMonitoringCondition() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::Condition::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeConditionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.Condition response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute DegradationDirection */ class ReadActivatedCarbonFilterMonitoringDegradationDirection : public ReadAttribute { public: ReadActivatedCarbonFilterMonitoringDegradationDirection() : ReadAttribute("degradation-direction") { } ~ReadActivatedCarbonFilterMonitoringDegradationDirection() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::DegradationDirection::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.DegradationDirection response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ActivatedCarbonFilterMonitoring DegradationDirection read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActivatedCarbonFilterMonitoringDegradationDirection : public SubscribeAttribute { public: SubscribeAttributeActivatedCarbonFilterMonitoringDegradationDirection() : SubscribeAttribute("degradation-direction") { } ~SubscribeAttributeActivatedCarbonFilterMonitoringDegradationDirection() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::DegradationDirection::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDegradationDirectionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.DegradationDirection response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ChangeIndication */ class ReadActivatedCarbonFilterMonitoringChangeIndication : public ReadAttribute { public: ReadActivatedCarbonFilterMonitoringChangeIndication() : ReadAttribute("change-indication") { } ~ReadActivatedCarbonFilterMonitoringChangeIndication() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::ChangeIndication::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.ChangeIndication response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ActivatedCarbonFilterMonitoring ChangeIndication read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActivatedCarbonFilterMonitoringChangeIndication : public SubscribeAttribute { public: SubscribeAttributeActivatedCarbonFilterMonitoringChangeIndication() : SubscribeAttribute("change-indication") { } ~SubscribeAttributeActivatedCarbonFilterMonitoringChangeIndication() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::ChangeIndication::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeChangeIndicationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.ChangeIndication response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute InPlaceIndicator */ class ReadActivatedCarbonFilterMonitoringInPlaceIndicator : public ReadAttribute { public: ReadActivatedCarbonFilterMonitoringInPlaceIndicator() : ReadAttribute("in-place-indicator") { } ~ReadActivatedCarbonFilterMonitoringInPlaceIndicator() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::InPlaceIndicator::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.InPlaceIndicator response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ActivatedCarbonFilterMonitoring InPlaceIndicator read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActivatedCarbonFilterMonitoringInPlaceIndicator : public SubscribeAttribute { public: SubscribeAttributeActivatedCarbonFilterMonitoringInPlaceIndicator() : SubscribeAttribute("in-place-indicator") { } ~SubscribeAttributeActivatedCarbonFilterMonitoringInPlaceIndicator() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::InPlaceIndicator::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInPlaceIndicatorWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.InPlaceIndicator response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LastChangedTime */ class ReadActivatedCarbonFilterMonitoringLastChangedTime : public ReadAttribute { public: ReadActivatedCarbonFilterMonitoringLastChangedTime() : ReadAttribute("last-changed-time") { } ~ReadActivatedCarbonFilterMonitoringLastChangedTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::LastChangedTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLastChangedTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.LastChangedTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ActivatedCarbonFilterMonitoring LastChangedTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteActivatedCarbonFilterMonitoringLastChangedTime : public WriteAttribute { public: WriteActivatedCarbonFilterMonitoringLastChangedTime() : WriteAttribute("last-changed-time") { AddArgument("attr-name", "last-changed-time"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteActivatedCarbonFilterMonitoringLastChangedTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::LastChangedTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedInt:mValue.Value()]; } [cluster writeAttributeLastChangedTimeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ActivatedCarbonFilterMonitoring LastChangedTime write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeActivatedCarbonFilterMonitoringLastChangedTime : public SubscribeAttribute { public: SubscribeAttributeActivatedCarbonFilterMonitoringLastChangedTime() : SubscribeAttribute("last-changed-time") { } ~SubscribeAttributeActivatedCarbonFilterMonitoringLastChangedTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::LastChangedTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLastChangedTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.LastChangedTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ReplacementProductList */ class ReadActivatedCarbonFilterMonitoringReplacementProductList : public ReadAttribute { public: ReadActivatedCarbonFilterMonitoringReplacementProductList() : ReadAttribute("replacement-product-list") { } ~ReadActivatedCarbonFilterMonitoringReplacementProductList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::ReplacementProductList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeReplacementProductListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.ReplacementProductList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ActivatedCarbonFilterMonitoring ReplacementProductList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActivatedCarbonFilterMonitoringReplacementProductList : public SubscribeAttribute { public: SubscribeAttributeActivatedCarbonFilterMonitoringReplacementProductList() : SubscribeAttribute("replacement-product-list") { } ~SubscribeAttributeActivatedCarbonFilterMonitoringReplacementProductList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::ReplacementProductList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeReplacementProductListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.ReplacementProductList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadActivatedCarbonFilterMonitoringGeneratedCommandList : public ReadAttribute { public: ReadActivatedCarbonFilterMonitoringGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadActivatedCarbonFilterMonitoringGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ActivatedCarbonFilterMonitoring GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActivatedCarbonFilterMonitoringGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeActivatedCarbonFilterMonitoringGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeActivatedCarbonFilterMonitoringGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadActivatedCarbonFilterMonitoringAcceptedCommandList : public ReadAttribute { public: ReadActivatedCarbonFilterMonitoringAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadActivatedCarbonFilterMonitoringAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ActivatedCarbonFilterMonitoring AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActivatedCarbonFilterMonitoringAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeActivatedCarbonFilterMonitoringAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeActivatedCarbonFilterMonitoringAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadActivatedCarbonFilterMonitoringEventList : public ReadAttribute { public: ReadActivatedCarbonFilterMonitoringEventList() : ReadAttribute("event-list") { } ~ReadActivatedCarbonFilterMonitoringEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ActivatedCarbonFilterMonitoring EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActivatedCarbonFilterMonitoringEventList : public SubscribeAttribute { public: SubscribeAttributeActivatedCarbonFilterMonitoringEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeActivatedCarbonFilterMonitoringEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadActivatedCarbonFilterMonitoringAttributeList : public ReadAttribute { public: ReadActivatedCarbonFilterMonitoringAttributeList() : ReadAttribute("attribute-list") { } ~ReadActivatedCarbonFilterMonitoringAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ActivatedCarbonFilterMonitoring AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActivatedCarbonFilterMonitoringAttributeList : public SubscribeAttribute { public: SubscribeAttributeActivatedCarbonFilterMonitoringAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeActivatedCarbonFilterMonitoringAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadActivatedCarbonFilterMonitoringFeatureMap : public ReadAttribute { public: ReadActivatedCarbonFilterMonitoringFeatureMap() : ReadAttribute("feature-map") { } ~ReadActivatedCarbonFilterMonitoringFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ActivatedCarbonFilterMonitoring FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActivatedCarbonFilterMonitoringFeatureMap : public SubscribeAttribute { public: SubscribeAttributeActivatedCarbonFilterMonitoringFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeActivatedCarbonFilterMonitoringFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadActivatedCarbonFilterMonitoringClusterRevision : public ReadAttribute { public: ReadActivatedCarbonFilterMonitoringClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadActivatedCarbonFilterMonitoringClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ActivatedCarbonFilterMonitoring ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeActivatedCarbonFilterMonitoringClusterRevision : public SubscribeAttribute { public: SubscribeAttributeActivatedCarbonFilterMonitoringClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeActivatedCarbonFilterMonitoringClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ActivatedCarbonFilterMonitoring::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ActivatedCarbonFilterMonitoring.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster BooleanStateConfiguration | 0x0080 | |------------------------------------------------------------------------------| | Commands: | | | * SuppressAlarm | 0x00 | | * EnableDisableAlarm | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | | * CurrentSensitivityLevel | 0x0000 | | * SupportedSensitivityLevels | 0x0001 | | * DefaultSensitivityLevel | 0x0002 | | * AlarmsActive | 0x0003 | | * AlarmsSuppressed | 0x0004 | | * AlarmsEnabled | 0x0005 | | * AlarmsSupported | 0x0006 | | * SensorFault | 0x0007 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * AlarmsStateChanged | 0x0000 | | * SensorFault | 0x0001 | \*----------------------------------------------------------------------------*/ /* * Command SuppressAlarm */ class BooleanStateConfigurationSuppressAlarm : public ClusterCommand { public: BooleanStateConfigurationSuppressAlarm() : ClusterCommand("suppress-alarm") { AddArgument("AlarmsToSuppress", 0, UINT8_MAX, &mRequest.alarmsToSuppress); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::CommandId commandId = chip::app::Clusters::BooleanStateConfiguration::Commands::SuppressAlarm::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRBooleanStateConfigurationClusterSuppressAlarmParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.alarmsToSuppress = [NSNumber numberWithUnsignedChar:mRequest.alarmsToSuppress.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster suppressAlarmWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::BooleanStateConfiguration::Commands::SuppressAlarm::Type mRequest; }; /* * Command EnableDisableAlarm */ class BooleanStateConfigurationEnableDisableAlarm : public ClusterCommand { public: BooleanStateConfigurationEnableDisableAlarm() : ClusterCommand("enable-disable-alarm") { AddArgument("AlarmsToEnableDisable", 0, UINT8_MAX, &mRequest.alarmsToEnableDisable); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::CommandId commandId = chip::app::Clusters::BooleanStateConfiguration::Commands::EnableDisableAlarm::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRBooleanStateConfigurationClusterEnableDisableAlarmParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.alarmsToEnableDisable = [NSNumber numberWithUnsignedChar:mRequest.alarmsToEnableDisable.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster enableDisableAlarmWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::BooleanStateConfiguration::Commands::EnableDisableAlarm::Type mRequest; }; /* * Attribute CurrentSensitivityLevel */ class ReadBooleanStateConfigurationCurrentSensitivityLevel : public ReadAttribute { public: ReadBooleanStateConfigurationCurrentSensitivityLevel() : ReadAttribute("current-sensitivity-level") { } ~ReadBooleanStateConfigurationCurrentSensitivityLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::CurrentSensitivityLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentSensitivityLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.CurrentSensitivityLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanStateConfiguration CurrentSensitivityLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteBooleanStateConfigurationCurrentSensitivityLevel : public WriteAttribute { public: WriteBooleanStateConfigurationCurrentSensitivityLevel() : WriteAttribute("current-sensitivity-level") { AddArgument("attr-name", "current-sensitivity-level"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteBooleanStateConfigurationCurrentSensitivityLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::CurrentSensitivityLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeCurrentSensitivityLevelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("BooleanStateConfiguration CurrentSensitivityLevel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeBooleanStateConfigurationCurrentSensitivityLevel : public SubscribeAttribute { public: SubscribeAttributeBooleanStateConfigurationCurrentSensitivityLevel() : SubscribeAttribute("current-sensitivity-level") { } ~SubscribeAttributeBooleanStateConfigurationCurrentSensitivityLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::CurrentSensitivityLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentSensitivityLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.CurrentSensitivityLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SupportedSensitivityLevels */ class ReadBooleanStateConfigurationSupportedSensitivityLevels : public ReadAttribute { public: ReadBooleanStateConfigurationSupportedSensitivityLevels() : ReadAttribute("supported-sensitivity-levels") { } ~ReadBooleanStateConfigurationSupportedSensitivityLevels() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::SupportedSensitivityLevels::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedSensitivityLevelsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.SupportedSensitivityLevels response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanStateConfiguration SupportedSensitivityLevels read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateConfigurationSupportedSensitivityLevels : public SubscribeAttribute { public: SubscribeAttributeBooleanStateConfigurationSupportedSensitivityLevels() : SubscribeAttribute("supported-sensitivity-levels") { } ~SubscribeAttributeBooleanStateConfigurationSupportedSensitivityLevels() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::SupportedSensitivityLevels::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedSensitivityLevelsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.SupportedSensitivityLevels response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute DefaultSensitivityLevel */ class ReadBooleanStateConfigurationDefaultSensitivityLevel : public ReadAttribute { public: ReadBooleanStateConfigurationDefaultSensitivityLevel() : ReadAttribute("default-sensitivity-level") { } ~ReadBooleanStateConfigurationDefaultSensitivityLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::DefaultSensitivityLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDefaultSensitivityLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.DefaultSensitivityLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanStateConfiguration DefaultSensitivityLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateConfigurationDefaultSensitivityLevel : public SubscribeAttribute { public: SubscribeAttributeBooleanStateConfigurationDefaultSensitivityLevel() : SubscribeAttribute("default-sensitivity-level") { } ~SubscribeAttributeBooleanStateConfigurationDefaultSensitivityLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::DefaultSensitivityLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDefaultSensitivityLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.DefaultSensitivityLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AlarmsActive */ class ReadBooleanStateConfigurationAlarmsActive : public ReadAttribute { public: ReadBooleanStateConfigurationAlarmsActive() : ReadAttribute("alarms-active") { } ~ReadBooleanStateConfigurationAlarmsActive() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::AlarmsActive::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAlarmsActiveWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.AlarmsActive response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanStateConfiguration AlarmsActive read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateConfigurationAlarmsActive : public SubscribeAttribute { public: SubscribeAttributeBooleanStateConfigurationAlarmsActive() : SubscribeAttribute("alarms-active") { } ~SubscribeAttributeBooleanStateConfigurationAlarmsActive() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::AlarmsActive::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAlarmsActiveWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.AlarmsActive response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AlarmsSuppressed */ class ReadBooleanStateConfigurationAlarmsSuppressed : public ReadAttribute { public: ReadBooleanStateConfigurationAlarmsSuppressed() : ReadAttribute("alarms-suppressed") { } ~ReadBooleanStateConfigurationAlarmsSuppressed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::AlarmsSuppressed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAlarmsSuppressedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.AlarmsSuppressed response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanStateConfiguration AlarmsSuppressed read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateConfigurationAlarmsSuppressed : public SubscribeAttribute { public: SubscribeAttributeBooleanStateConfigurationAlarmsSuppressed() : SubscribeAttribute("alarms-suppressed") { } ~SubscribeAttributeBooleanStateConfigurationAlarmsSuppressed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::AlarmsSuppressed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAlarmsSuppressedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.AlarmsSuppressed response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AlarmsEnabled */ class ReadBooleanStateConfigurationAlarmsEnabled : public ReadAttribute { public: ReadBooleanStateConfigurationAlarmsEnabled() : ReadAttribute("alarms-enabled") { } ~ReadBooleanStateConfigurationAlarmsEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::AlarmsEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAlarmsEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.AlarmsEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanStateConfiguration AlarmsEnabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateConfigurationAlarmsEnabled : public SubscribeAttribute { public: SubscribeAttributeBooleanStateConfigurationAlarmsEnabled() : SubscribeAttribute("alarms-enabled") { } ~SubscribeAttributeBooleanStateConfigurationAlarmsEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::AlarmsEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAlarmsEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.AlarmsEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AlarmsSupported */ class ReadBooleanStateConfigurationAlarmsSupported : public ReadAttribute { public: ReadBooleanStateConfigurationAlarmsSupported() : ReadAttribute("alarms-supported") { } ~ReadBooleanStateConfigurationAlarmsSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::AlarmsSupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAlarmsSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.AlarmsSupported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanStateConfiguration AlarmsSupported read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateConfigurationAlarmsSupported : public SubscribeAttribute { public: SubscribeAttributeBooleanStateConfigurationAlarmsSupported() : SubscribeAttribute("alarms-supported") { } ~SubscribeAttributeBooleanStateConfigurationAlarmsSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::AlarmsSupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAlarmsSupportedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.AlarmsSupported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SensorFault */ class ReadBooleanStateConfigurationSensorFault : public ReadAttribute { public: ReadBooleanStateConfigurationSensorFault() : ReadAttribute("sensor-fault") { } ~ReadBooleanStateConfigurationSensorFault() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::SensorFault::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSensorFaultWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.SensorFault response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanStateConfiguration SensorFault read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateConfigurationSensorFault : public SubscribeAttribute { public: SubscribeAttributeBooleanStateConfigurationSensorFault() : SubscribeAttribute("sensor-fault") { } ~SubscribeAttributeBooleanStateConfigurationSensorFault() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::SensorFault::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSensorFaultWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.SensorFault response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadBooleanStateConfigurationGeneratedCommandList : public ReadAttribute { public: ReadBooleanStateConfigurationGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadBooleanStateConfigurationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanStateConfiguration GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateConfigurationGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeBooleanStateConfigurationGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeBooleanStateConfigurationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadBooleanStateConfigurationAcceptedCommandList : public ReadAttribute { public: ReadBooleanStateConfigurationAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadBooleanStateConfigurationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanStateConfiguration AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateConfigurationAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeBooleanStateConfigurationAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeBooleanStateConfigurationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadBooleanStateConfigurationEventList : public ReadAttribute { public: ReadBooleanStateConfigurationEventList() : ReadAttribute("event-list") { } ~ReadBooleanStateConfigurationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanStateConfiguration EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateConfigurationEventList : public SubscribeAttribute { public: SubscribeAttributeBooleanStateConfigurationEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeBooleanStateConfigurationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadBooleanStateConfigurationAttributeList : public ReadAttribute { public: ReadBooleanStateConfigurationAttributeList() : ReadAttribute("attribute-list") { } ~ReadBooleanStateConfigurationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanStateConfiguration AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateConfigurationAttributeList : public SubscribeAttribute { public: SubscribeAttributeBooleanStateConfigurationAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeBooleanStateConfigurationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadBooleanStateConfigurationFeatureMap : public ReadAttribute { public: ReadBooleanStateConfigurationFeatureMap() : ReadAttribute("feature-map") { } ~ReadBooleanStateConfigurationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanStateConfiguration FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateConfigurationFeatureMap : public SubscribeAttribute { public: SubscribeAttributeBooleanStateConfigurationFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeBooleanStateConfigurationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadBooleanStateConfigurationClusterRevision : public ReadAttribute { public: ReadBooleanStateConfigurationClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadBooleanStateConfigurationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BooleanStateConfiguration ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBooleanStateConfigurationClusterRevision : public SubscribeAttribute { public: SubscribeAttributeBooleanStateConfigurationClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeBooleanStateConfigurationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BooleanStateConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BooleanStateConfiguration::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBooleanStateConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanStateConfiguration.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster ValveConfigurationAndControl | 0x0081 | |------------------------------------------------------------------------------| | Commands: | | | * Open | 0x00 | | * Close | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | | * OpenDuration | 0x0000 | | * DefaultOpenDuration | 0x0001 | | * AutoCloseTime | 0x0002 | | * RemainingDuration | 0x0003 | | * CurrentState | 0x0004 | | * TargetState | 0x0005 | | * CurrentLevel | 0x0006 | | * TargetLevel | 0x0007 | | * DefaultOpenLevel | 0x0008 | | * ValveFault | 0x0009 | | * LevelStep | 0x000A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * ValveStateChanged | 0x0000 | | * ValveFault | 0x0001 | \*----------------------------------------------------------------------------*/ /* * Command Open */ class ValveConfigurationAndControlOpen : public ClusterCommand { public: ValveConfigurationAndControlOpen() : ClusterCommand("open") { AddArgument("OpenDuration", 0, UINT32_MAX, &mRequest.openDuration); AddArgument("TargetLevel", 0, UINT8_MAX, &mRequest.targetLevel); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ValveConfigurationAndControl::Commands::Open::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRValveConfigurationAndControlClusterOpenParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; if (mRequest.openDuration.HasValue()) { if (mRequest.openDuration.Value().IsNull()) { params.openDuration = nil; } else { params.openDuration = [NSNumber numberWithUnsignedInt:mRequest.openDuration.Value().Value()]; } } else { params.openDuration = nil; } if (mRequest.targetLevel.HasValue()) { params.targetLevel = [NSNumber numberWithUnsignedChar:mRequest.targetLevel.Value()]; } else { params.targetLevel = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster openWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ValveConfigurationAndControl::Commands::Open::Type mRequest; }; /* * Command Close */ class ValveConfigurationAndControlClose : public ClusterCommand { public: ValveConfigurationAndControlClose() : ClusterCommand("close") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ValveConfigurationAndControl::Commands::Close::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRValveConfigurationAndControlClusterCloseParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster closeWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Attribute OpenDuration */ class ReadValveConfigurationAndControlOpenDuration : public ReadAttribute { public: ReadValveConfigurationAndControlOpenDuration() : ReadAttribute("open-duration") { } ~ReadValveConfigurationAndControlOpenDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::OpenDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOpenDurationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.OpenDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl OpenDuration read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeValveConfigurationAndControlOpenDuration : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlOpenDuration() : SubscribeAttribute("open-duration") { } ~SubscribeAttributeValveConfigurationAndControlOpenDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::OpenDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOpenDurationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.OpenDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute DefaultOpenDuration */ class ReadValveConfigurationAndControlDefaultOpenDuration : public ReadAttribute { public: ReadValveConfigurationAndControlDefaultOpenDuration() : ReadAttribute("default-open-duration") { } ~ReadValveConfigurationAndControlDefaultOpenDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::DefaultOpenDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDefaultOpenDurationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.DefaultOpenDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl DefaultOpenDuration read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteValveConfigurationAndControlDefaultOpenDuration : public WriteAttribute { public: WriteValveConfigurationAndControlDefaultOpenDuration() : WriteAttribute("default-open-duration") { AddArgument("attr-name", "default-open-duration"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteValveConfigurationAndControlDefaultOpenDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::DefaultOpenDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedInt:mValue.Value()]; } [cluster writeAttributeDefaultOpenDurationWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ValveConfigurationAndControl DefaultOpenDuration write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeValveConfigurationAndControlDefaultOpenDuration : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlDefaultOpenDuration() : SubscribeAttribute("default-open-duration") { } ~SubscribeAttributeValveConfigurationAndControlDefaultOpenDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::DefaultOpenDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDefaultOpenDurationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.DefaultOpenDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AutoCloseTime */ class ReadValveConfigurationAndControlAutoCloseTime : public ReadAttribute { public: ReadValveConfigurationAndControlAutoCloseTime() : ReadAttribute("auto-close-time") { } ~ReadValveConfigurationAndControlAutoCloseTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::AutoCloseTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAutoCloseTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.AutoCloseTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl AutoCloseTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeValveConfigurationAndControlAutoCloseTime : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlAutoCloseTime() : SubscribeAttribute("auto-close-time") { } ~SubscribeAttributeValveConfigurationAndControlAutoCloseTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::AutoCloseTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAutoCloseTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.AutoCloseTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RemainingDuration */ class ReadValveConfigurationAndControlRemainingDuration : public ReadAttribute { public: ReadValveConfigurationAndControlRemainingDuration() : ReadAttribute("remaining-duration") { } ~ReadValveConfigurationAndControlRemainingDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::RemainingDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRemainingDurationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.RemainingDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl RemainingDuration read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeValveConfigurationAndControlRemainingDuration : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlRemainingDuration() : SubscribeAttribute("remaining-duration") { } ~SubscribeAttributeValveConfigurationAndControlRemainingDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::RemainingDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRemainingDurationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.RemainingDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentState */ class ReadValveConfigurationAndControlCurrentState : public ReadAttribute { public: ReadValveConfigurationAndControlCurrentState() : ReadAttribute("current-state") { } ~ReadValveConfigurationAndControlCurrentState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::CurrentState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.CurrentState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl CurrentState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeValveConfigurationAndControlCurrentState : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlCurrentState() : SubscribeAttribute("current-state") { } ~SubscribeAttributeValveConfigurationAndControlCurrentState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::CurrentState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.CurrentState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TargetState */ class ReadValveConfigurationAndControlTargetState : public ReadAttribute { public: ReadValveConfigurationAndControlTargetState() : ReadAttribute("target-state") { } ~ReadValveConfigurationAndControlTargetState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::TargetState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTargetStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.TargetState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl TargetState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeValveConfigurationAndControlTargetState : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlTargetState() : SubscribeAttribute("target-state") { } ~SubscribeAttributeValveConfigurationAndControlTargetState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::TargetState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTargetStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.TargetState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentLevel */ class ReadValveConfigurationAndControlCurrentLevel : public ReadAttribute { public: ReadValveConfigurationAndControlCurrentLevel() : ReadAttribute("current-level") { } ~ReadValveConfigurationAndControlCurrentLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::CurrentLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.CurrentLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl CurrentLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeValveConfigurationAndControlCurrentLevel : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlCurrentLevel() : SubscribeAttribute("current-level") { } ~SubscribeAttributeValveConfigurationAndControlCurrentLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::CurrentLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.CurrentLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TargetLevel */ class ReadValveConfigurationAndControlTargetLevel : public ReadAttribute { public: ReadValveConfigurationAndControlTargetLevel() : ReadAttribute("target-level") { } ~ReadValveConfigurationAndControlTargetLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::TargetLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTargetLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.TargetLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl TargetLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeValveConfigurationAndControlTargetLevel : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlTargetLevel() : SubscribeAttribute("target-level") { } ~SubscribeAttributeValveConfigurationAndControlTargetLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::TargetLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTargetLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.TargetLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute DefaultOpenLevel */ class ReadValveConfigurationAndControlDefaultOpenLevel : public ReadAttribute { public: ReadValveConfigurationAndControlDefaultOpenLevel() : ReadAttribute("default-open-level") { } ~ReadValveConfigurationAndControlDefaultOpenLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::DefaultOpenLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDefaultOpenLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.DefaultOpenLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl DefaultOpenLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteValveConfigurationAndControlDefaultOpenLevel : public WriteAttribute { public: WriteValveConfigurationAndControlDefaultOpenLevel() : WriteAttribute("default-open-level") { AddArgument("attr-name", "default-open-level"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteValveConfigurationAndControlDefaultOpenLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::DefaultOpenLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeDefaultOpenLevelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ValveConfigurationAndControl DefaultOpenLevel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::Percent mValue; }; class SubscribeAttributeValveConfigurationAndControlDefaultOpenLevel : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlDefaultOpenLevel() : SubscribeAttribute("default-open-level") { } ~SubscribeAttributeValveConfigurationAndControlDefaultOpenLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::DefaultOpenLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDefaultOpenLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.DefaultOpenLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ValveFault */ class ReadValveConfigurationAndControlValveFault : public ReadAttribute { public: ReadValveConfigurationAndControlValveFault() : ReadAttribute("valve-fault") { } ~ReadValveConfigurationAndControlValveFault() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::ValveFault::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeValveFaultWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.ValveFault response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl ValveFault read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeValveConfigurationAndControlValveFault : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlValveFault() : SubscribeAttribute("valve-fault") { } ~SubscribeAttributeValveConfigurationAndControlValveFault() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::ValveFault::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeValveFaultWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.ValveFault response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LevelStep */ class ReadValveConfigurationAndControlLevelStep : public ReadAttribute { public: ReadValveConfigurationAndControlLevelStep() : ReadAttribute("level-step") { } ~ReadValveConfigurationAndControlLevelStep() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::LevelStep::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLevelStepWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.LevelStep response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl LevelStep read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeValveConfigurationAndControlLevelStep : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlLevelStep() : SubscribeAttribute("level-step") { } ~SubscribeAttributeValveConfigurationAndControlLevelStep() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::LevelStep::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLevelStepWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.LevelStep response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadValveConfigurationAndControlGeneratedCommandList : public ReadAttribute { public: ReadValveConfigurationAndControlGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadValveConfigurationAndControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeValveConfigurationAndControlGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeValveConfigurationAndControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadValveConfigurationAndControlAcceptedCommandList : public ReadAttribute { public: ReadValveConfigurationAndControlAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadValveConfigurationAndControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeValveConfigurationAndControlAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeValveConfigurationAndControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadValveConfigurationAndControlEventList : public ReadAttribute { public: ReadValveConfigurationAndControlEventList() : ReadAttribute("event-list") { } ~ReadValveConfigurationAndControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeValveConfigurationAndControlEventList : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeValveConfigurationAndControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadValveConfigurationAndControlAttributeList : public ReadAttribute { public: ReadValveConfigurationAndControlAttributeList() : ReadAttribute("attribute-list") { } ~ReadValveConfigurationAndControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeValveConfigurationAndControlAttributeList : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeValveConfigurationAndControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadValveConfigurationAndControlFeatureMap : public ReadAttribute { public: ReadValveConfigurationAndControlFeatureMap() : ReadAttribute("feature-map") { } ~ReadValveConfigurationAndControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeValveConfigurationAndControlFeatureMap : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeValveConfigurationAndControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadValveConfigurationAndControlClusterRevision : public ReadAttribute { public: ReadValveConfigurationAndControlClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadValveConfigurationAndControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ValveConfigurationAndControl ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeValveConfigurationAndControlClusterRevision : public SubscribeAttribute { public: SubscribeAttributeValveConfigurationAndControlClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeValveConfigurationAndControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ValveConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ValveConfigurationAndControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterValveConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ValveConfigurationAndControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster ElectricalPowerMeasurement | 0x0090 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * PowerMode | 0x0000 | | * NumberOfMeasurementTypes | 0x0001 | | * Accuracy | 0x0002 | | * Ranges | 0x0003 | | * Voltage | 0x0004 | | * ActiveCurrent | 0x0005 | | * ReactiveCurrent | 0x0006 | | * ApparentCurrent | 0x0007 | | * ActivePower | 0x0008 | | * ReactivePower | 0x0009 | | * ApparentPower | 0x000A | | * RMSVoltage | 0x000B | | * RMSCurrent | 0x000C | | * RMSPower | 0x000D | | * Frequency | 0x000E | | * HarmonicCurrents | 0x000F | | * HarmonicPhases | 0x0010 | | * PowerFactor | 0x0011 | | * NeutralCurrent | 0x0012 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * MeasurementPeriodRanges | 0x0000 | \*----------------------------------------------------------------------------*/ /* * Attribute PowerMode */ class ReadElectricalPowerMeasurementPowerMode : public ReadAttribute { public: ReadElectricalPowerMeasurementPowerMode() : ReadAttribute("power-mode") { } ~ReadElectricalPowerMeasurementPowerMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::PowerMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePowerModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.PowerMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement PowerMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementPowerMode : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementPowerMode() : SubscribeAttribute("power-mode") { } ~SubscribeAttributeElectricalPowerMeasurementPowerMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::PowerMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePowerModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.PowerMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NumberOfMeasurementTypes */ class ReadElectricalPowerMeasurementNumberOfMeasurementTypes : public ReadAttribute { public: ReadElectricalPowerMeasurementNumberOfMeasurementTypes() : ReadAttribute("number-of-measurement-types") { } ~ReadElectricalPowerMeasurementNumberOfMeasurementTypes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::NumberOfMeasurementTypes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfMeasurementTypesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.NumberOfMeasurementTypes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement NumberOfMeasurementTypes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementNumberOfMeasurementTypes : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementNumberOfMeasurementTypes() : SubscribeAttribute("number-of-measurement-types") { } ~SubscribeAttributeElectricalPowerMeasurementNumberOfMeasurementTypes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::NumberOfMeasurementTypes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfMeasurementTypesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.NumberOfMeasurementTypes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Accuracy */ class ReadElectricalPowerMeasurementAccuracy : public ReadAttribute { public: ReadElectricalPowerMeasurementAccuracy() : ReadAttribute("accuracy") { } ~ReadElectricalPowerMeasurementAccuracy() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Accuracy::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAccuracyWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.Accuracy response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement Accuracy read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementAccuracy : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementAccuracy() : SubscribeAttribute("accuracy") { } ~SubscribeAttributeElectricalPowerMeasurementAccuracy() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Accuracy::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAccuracyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.Accuracy response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Ranges */ class ReadElectricalPowerMeasurementRanges : public ReadAttribute { public: ReadElectricalPowerMeasurementRanges() : ReadAttribute("ranges") { } ~ReadElectricalPowerMeasurementRanges() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Ranges::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRangesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.Ranges response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement Ranges read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementRanges : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementRanges() : SubscribeAttribute("ranges") { } ~SubscribeAttributeElectricalPowerMeasurementRanges() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Ranges::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRangesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.Ranges response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Voltage */ class ReadElectricalPowerMeasurementVoltage : public ReadAttribute { public: ReadElectricalPowerMeasurementVoltage() : ReadAttribute("voltage") { } ~ReadElectricalPowerMeasurementVoltage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Voltage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.Voltage response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement Voltage read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementVoltage : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementVoltage() : SubscribeAttribute("voltage") { } ~SubscribeAttributeElectricalPowerMeasurementVoltage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Voltage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeVoltageWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.Voltage response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ActiveCurrent */ class ReadElectricalPowerMeasurementActiveCurrent : public ReadAttribute { public: ReadElectricalPowerMeasurementActiveCurrent() : ReadAttribute("active-current") { } ~ReadElectricalPowerMeasurementActiveCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ActiveCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.ActiveCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement ActiveCurrent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementActiveCurrent : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementActiveCurrent() : SubscribeAttribute("active-current") { } ~SubscribeAttributeElectricalPowerMeasurementActiveCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ActiveCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveCurrentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.ActiveCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ReactiveCurrent */ class ReadElectricalPowerMeasurementReactiveCurrent : public ReadAttribute { public: ReadElectricalPowerMeasurementReactiveCurrent() : ReadAttribute("reactive-current") { } ~ReadElectricalPowerMeasurementReactiveCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ReactiveCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeReactiveCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.ReactiveCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement ReactiveCurrent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementReactiveCurrent : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementReactiveCurrent() : SubscribeAttribute("reactive-current") { } ~SubscribeAttributeElectricalPowerMeasurementReactiveCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ReactiveCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeReactiveCurrentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.ReactiveCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ApparentCurrent */ class ReadElectricalPowerMeasurementApparentCurrent : public ReadAttribute { public: ReadElectricalPowerMeasurementApparentCurrent() : ReadAttribute("apparent-current") { } ~ReadElectricalPowerMeasurementApparentCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ApparentCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeApparentCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.ApparentCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement ApparentCurrent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementApparentCurrent : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementApparentCurrent() : SubscribeAttribute("apparent-current") { } ~SubscribeAttributeElectricalPowerMeasurementApparentCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ApparentCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeApparentCurrentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.ApparentCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ActivePower */ class ReadElectricalPowerMeasurementActivePower : public ReadAttribute { public: ReadElectricalPowerMeasurementActivePower() : ReadAttribute("active-power") { } ~ReadElectricalPowerMeasurementActivePower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ActivePower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActivePowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.ActivePower response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement ActivePower read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementActivePower : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementActivePower() : SubscribeAttribute("active-power") { } ~SubscribeAttributeElectricalPowerMeasurementActivePower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ActivePower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActivePowerWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.ActivePower response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ReactivePower */ class ReadElectricalPowerMeasurementReactivePower : public ReadAttribute { public: ReadElectricalPowerMeasurementReactivePower() : ReadAttribute("reactive-power") { } ~ReadElectricalPowerMeasurementReactivePower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ReactivePower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeReactivePowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.ReactivePower response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement ReactivePower read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementReactivePower : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementReactivePower() : SubscribeAttribute("reactive-power") { } ~SubscribeAttributeElectricalPowerMeasurementReactivePower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ReactivePower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeReactivePowerWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.ReactivePower response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ApparentPower */ class ReadElectricalPowerMeasurementApparentPower : public ReadAttribute { public: ReadElectricalPowerMeasurementApparentPower() : ReadAttribute("apparent-power") { } ~ReadElectricalPowerMeasurementApparentPower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ApparentPower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeApparentPowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.ApparentPower response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement ApparentPower read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementApparentPower : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementApparentPower() : SubscribeAttribute("apparent-power") { } ~SubscribeAttributeElectricalPowerMeasurementApparentPower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ApparentPower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeApparentPowerWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.ApparentPower response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RMSVoltage */ class ReadElectricalPowerMeasurementRMSVoltage : public ReadAttribute { public: ReadElectricalPowerMeasurementRMSVoltage() : ReadAttribute("rmsvoltage") { } ~ReadElectricalPowerMeasurementRMSVoltage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::RMSVoltage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRMSVoltageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.RMSVoltage response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement RMSVoltage read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementRMSVoltage : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementRMSVoltage() : SubscribeAttribute("rmsvoltage") { } ~SubscribeAttributeElectricalPowerMeasurementRMSVoltage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::RMSVoltage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRMSVoltageWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.RMSVoltage response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RMSCurrent */ class ReadElectricalPowerMeasurementRMSCurrent : public ReadAttribute { public: ReadElectricalPowerMeasurementRMSCurrent() : ReadAttribute("rmscurrent") { } ~ReadElectricalPowerMeasurementRMSCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::RMSCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRMSCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.RMSCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement RMSCurrent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementRMSCurrent : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementRMSCurrent() : SubscribeAttribute("rmscurrent") { } ~SubscribeAttributeElectricalPowerMeasurementRMSCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::RMSCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRMSCurrentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.RMSCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RMSPower */ class ReadElectricalPowerMeasurementRMSPower : public ReadAttribute { public: ReadElectricalPowerMeasurementRMSPower() : ReadAttribute("rmspower") { } ~ReadElectricalPowerMeasurementRMSPower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::RMSPower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRMSPowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.RMSPower response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement RMSPower read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementRMSPower : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementRMSPower() : SubscribeAttribute("rmspower") { } ~SubscribeAttributeElectricalPowerMeasurementRMSPower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::RMSPower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRMSPowerWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.RMSPower response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Frequency */ class ReadElectricalPowerMeasurementFrequency : public ReadAttribute { public: ReadElectricalPowerMeasurementFrequency() : ReadAttribute("frequency") { } ~ReadElectricalPowerMeasurementFrequency() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Frequency::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFrequencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.Frequency response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement Frequency read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementFrequency : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementFrequency() : SubscribeAttribute("frequency") { } ~SubscribeAttributeElectricalPowerMeasurementFrequency() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::Frequency::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFrequencyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.Frequency response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute HarmonicCurrents */ class ReadElectricalPowerMeasurementHarmonicCurrents : public ReadAttribute { public: ReadElectricalPowerMeasurementHarmonicCurrents() : ReadAttribute("harmonic-currents") { } ~ReadElectricalPowerMeasurementHarmonicCurrents() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::HarmonicCurrents::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeHarmonicCurrentsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.HarmonicCurrents response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement HarmonicCurrents read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementHarmonicCurrents : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementHarmonicCurrents() : SubscribeAttribute("harmonic-currents") { } ~SubscribeAttributeElectricalPowerMeasurementHarmonicCurrents() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::HarmonicCurrents::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeHarmonicCurrentsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.HarmonicCurrents response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute HarmonicPhases */ class ReadElectricalPowerMeasurementHarmonicPhases : public ReadAttribute { public: ReadElectricalPowerMeasurementHarmonicPhases() : ReadAttribute("harmonic-phases") { } ~ReadElectricalPowerMeasurementHarmonicPhases() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::HarmonicPhases::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeHarmonicPhasesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.HarmonicPhases response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement HarmonicPhases read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementHarmonicPhases : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementHarmonicPhases() : SubscribeAttribute("harmonic-phases") { } ~SubscribeAttributeElectricalPowerMeasurementHarmonicPhases() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::HarmonicPhases::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeHarmonicPhasesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.HarmonicPhases response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PowerFactor */ class ReadElectricalPowerMeasurementPowerFactor : public ReadAttribute { public: ReadElectricalPowerMeasurementPowerFactor() : ReadAttribute("power-factor") { } ~ReadElectricalPowerMeasurementPowerFactor() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::PowerFactor::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePowerFactorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.PowerFactor response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement PowerFactor read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementPowerFactor : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementPowerFactor() : SubscribeAttribute("power-factor") { } ~SubscribeAttributeElectricalPowerMeasurementPowerFactor() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::PowerFactor::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePowerFactorWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.PowerFactor response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NeutralCurrent */ class ReadElectricalPowerMeasurementNeutralCurrent : public ReadAttribute { public: ReadElectricalPowerMeasurementNeutralCurrent() : ReadAttribute("neutral-current") { } ~ReadElectricalPowerMeasurementNeutralCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::NeutralCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNeutralCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.NeutralCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement NeutralCurrent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementNeutralCurrent : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementNeutralCurrent() : SubscribeAttribute("neutral-current") { } ~SubscribeAttributeElectricalPowerMeasurementNeutralCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::NeutralCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNeutralCurrentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.NeutralCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadElectricalPowerMeasurementGeneratedCommandList : public ReadAttribute { public: ReadElectricalPowerMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadElectricalPowerMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeElectricalPowerMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadElectricalPowerMeasurementAcceptedCommandList : public ReadAttribute { public: ReadElectricalPowerMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadElectricalPowerMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeElectricalPowerMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadElectricalPowerMeasurementEventList : public ReadAttribute { public: ReadElectricalPowerMeasurementEventList() : ReadAttribute("event-list") { } ~ReadElectricalPowerMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeElectricalPowerMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadElectricalPowerMeasurementAttributeList : public ReadAttribute { public: ReadElectricalPowerMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadElectricalPowerMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeElectricalPowerMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadElectricalPowerMeasurementFeatureMap : public ReadAttribute { public: ReadElectricalPowerMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadElectricalPowerMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeElectricalPowerMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadElectricalPowerMeasurementClusterRevision : public ReadAttribute { public: ReadElectricalPowerMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadElectricalPowerMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalPowerMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalPowerMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeElectricalPowerMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeElectricalPowerMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalPowerMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalPowerMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalPowerMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalPowerMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster ElectricalEnergyMeasurement | 0x0091 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * Accuracy | 0x0000 | | * CumulativeEnergyImported | 0x0001 | | * CumulativeEnergyExported | 0x0002 | | * PeriodicEnergyImported | 0x0003 | | * PeriodicEnergyExported | 0x0004 | | * CumulativeEnergyReset | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * CumulativeEnergyMeasured | 0x0000 | | * PeriodicEnergyMeasured | 0x0001 | \*----------------------------------------------------------------------------*/ /* * Attribute Accuracy */ class ReadElectricalEnergyMeasurementAccuracy : public ReadAttribute { public: ReadElectricalEnergyMeasurementAccuracy() : ReadAttribute("accuracy") { } ~ReadElectricalEnergyMeasurementAccuracy() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::Accuracy::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAccuracyWithCompletion:^(MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.Accuracy response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalEnergyMeasurement Accuracy read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalEnergyMeasurementAccuracy : public SubscribeAttribute { public: SubscribeAttributeElectricalEnergyMeasurementAccuracy() : SubscribeAttribute("accuracy") { } ~SubscribeAttributeElectricalEnergyMeasurementAccuracy() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::Accuracy::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAccuracyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRElectricalEnergyMeasurementClusterMeasurementAccuracyStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.Accuracy response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CumulativeEnergyImported */ class ReadElectricalEnergyMeasurementCumulativeEnergyImported : public ReadAttribute { public: ReadElectricalEnergyMeasurementCumulativeEnergyImported() : ReadAttribute("cumulative-energy-imported") { } ~ReadElectricalEnergyMeasurementCumulativeEnergyImported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::CumulativeEnergyImported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCumulativeEnergyImportedWithCompletion:^(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.CumulativeEnergyImported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalEnergyMeasurement CumulativeEnergyImported read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyImported : public SubscribeAttribute { public: SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyImported() : SubscribeAttribute("cumulative-energy-imported") { } ~SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyImported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::CumulativeEnergyImported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCumulativeEnergyImportedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.CumulativeEnergyImported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CumulativeEnergyExported */ class ReadElectricalEnergyMeasurementCumulativeEnergyExported : public ReadAttribute { public: ReadElectricalEnergyMeasurementCumulativeEnergyExported() : ReadAttribute("cumulative-energy-exported") { } ~ReadElectricalEnergyMeasurementCumulativeEnergyExported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::CumulativeEnergyExported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCumulativeEnergyExportedWithCompletion:^(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.CumulativeEnergyExported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalEnergyMeasurement CumulativeEnergyExported read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyExported : public SubscribeAttribute { public: SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyExported() : SubscribeAttribute("cumulative-energy-exported") { } ~SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyExported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::CumulativeEnergyExported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCumulativeEnergyExportedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.CumulativeEnergyExported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeriodicEnergyImported */ class ReadElectricalEnergyMeasurementPeriodicEnergyImported : public ReadAttribute { public: ReadElectricalEnergyMeasurementPeriodicEnergyImported() : ReadAttribute("periodic-energy-imported") { } ~ReadElectricalEnergyMeasurementPeriodicEnergyImported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::PeriodicEnergyImported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeriodicEnergyImportedWithCompletion:^(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.PeriodicEnergyImported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalEnergyMeasurement PeriodicEnergyImported read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalEnergyMeasurementPeriodicEnergyImported : public SubscribeAttribute { public: SubscribeAttributeElectricalEnergyMeasurementPeriodicEnergyImported() : SubscribeAttribute("periodic-energy-imported") { } ~SubscribeAttributeElectricalEnergyMeasurementPeriodicEnergyImported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::PeriodicEnergyImported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeriodicEnergyImportedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.PeriodicEnergyImported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeriodicEnergyExported */ class ReadElectricalEnergyMeasurementPeriodicEnergyExported : public ReadAttribute { public: ReadElectricalEnergyMeasurementPeriodicEnergyExported() : ReadAttribute("periodic-energy-exported") { } ~ReadElectricalEnergyMeasurementPeriodicEnergyExported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::PeriodicEnergyExported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeriodicEnergyExportedWithCompletion:^(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.PeriodicEnergyExported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalEnergyMeasurement PeriodicEnergyExported read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalEnergyMeasurementPeriodicEnergyExported : public SubscribeAttribute { public: SubscribeAttributeElectricalEnergyMeasurementPeriodicEnergyExported() : SubscribeAttribute("periodic-energy-exported") { } ~SubscribeAttributeElectricalEnergyMeasurementPeriodicEnergyExported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::PeriodicEnergyExported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeriodicEnergyExportedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRElectricalEnergyMeasurementClusterEnergyMeasurementStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.PeriodicEnergyExported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CumulativeEnergyReset */ class ReadElectricalEnergyMeasurementCumulativeEnergyReset : public ReadAttribute { public: ReadElectricalEnergyMeasurementCumulativeEnergyReset() : ReadAttribute("cumulative-energy-reset") { } ~ReadElectricalEnergyMeasurementCumulativeEnergyReset() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::CumulativeEnergyReset::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCumulativeEnergyResetWithCompletion:^(MTRElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.CumulativeEnergyReset response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalEnergyMeasurement CumulativeEnergyReset read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyReset : public SubscribeAttribute { public: SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyReset() : SubscribeAttribute("cumulative-energy-reset") { } ~SubscribeAttributeElectricalEnergyMeasurementCumulativeEnergyReset() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::CumulativeEnergyReset::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCumulativeEnergyResetWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.CumulativeEnergyReset response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadElectricalEnergyMeasurementGeneratedCommandList : public ReadAttribute { public: ReadElectricalEnergyMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadElectricalEnergyMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalEnergyMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalEnergyMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeElectricalEnergyMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeElectricalEnergyMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadElectricalEnergyMeasurementAcceptedCommandList : public ReadAttribute { public: ReadElectricalEnergyMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadElectricalEnergyMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalEnergyMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalEnergyMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeElectricalEnergyMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeElectricalEnergyMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadElectricalEnergyMeasurementEventList : public ReadAttribute { public: ReadElectricalEnergyMeasurementEventList() : ReadAttribute("event-list") { } ~ReadElectricalEnergyMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalEnergyMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalEnergyMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributeElectricalEnergyMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeElectricalEnergyMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadElectricalEnergyMeasurementAttributeList : public ReadAttribute { public: ReadElectricalEnergyMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadElectricalEnergyMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalEnergyMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalEnergyMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributeElectricalEnergyMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeElectricalEnergyMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadElectricalEnergyMeasurementFeatureMap : public ReadAttribute { public: ReadElectricalEnergyMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadElectricalEnergyMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalEnergyMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalEnergyMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeElectricalEnergyMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeElectricalEnergyMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadElectricalEnergyMeasurementClusterRevision : public ReadAttribute { public: ReadElectricalEnergyMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadElectricalEnergyMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ElectricalEnergyMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeElectricalEnergyMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeElectricalEnergyMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeElectricalEnergyMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ElectricalEnergyMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ElectricalEnergyMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterElectricalEnergyMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalEnergyMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster WaterHeaterManagement | 0x0094 | |------------------------------------------------------------------------------| | Commands: | | | * Boost | 0x00 | | * CancelBoost | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | | * HeaterTypes | 0x0000 | | * HeatDemand | 0x0001 | | * TankVolume | 0x0002 | | * EstimatedHeatRequired | 0x0003 | | * TankPercentage | 0x0004 | | * BoostState | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * BoostStarted | 0x0000 | | * BoostEnded | 0x0001 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command Boost */ class WaterHeaterManagementBoost : public ClusterCommand { public: WaterHeaterManagementBoost() : ClusterCommand("boost") , mComplex_BoostInfo(&mRequest.boostInfo) { #if MTR_ENABLE_PROVISIONAL AddArgument("BoostInfo", &mComplex_BoostInfo); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WaterHeaterManagement::Commands::Boost::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWaterHeaterManagementClusterBoostParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.boostInfo = [MTRWaterHeaterManagementClusterWaterHeaterBoostInfoStruct new]; params.boostInfo.duration = [NSNumber numberWithUnsignedInt:mRequest.boostInfo.duration]; if (mRequest.boostInfo.oneShot.HasValue()) { params.boostInfo.oneShot = [NSNumber numberWithBool:mRequest.boostInfo.oneShot.Value()]; } else { params.boostInfo.oneShot = nil; } if (mRequest.boostInfo.emergencyBoost.HasValue()) { params.boostInfo.emergencyBoost = [NSNumber numberWithBool:mRequest.boostInfo.emergencyBoost.Value()]; } else { params.boostInfo.emergencyBoost = nil; } if (mRequest.boostInfo.temporarySetpoint.HasValue()) { params.boostInfo.temporarySetpoint = [NSNumber numberWithShort:mRequest.boostInfo.temporarySetpoint.Value()]; } else { params.boostInfo.temporarySetpoint = nil; } if (mRequest.boostInfo.targetPercentage.HasValue()) { params.boostInfo.targetPercentage = [NSNumber numberWithUnsignedChar:mRequest.boostInfo.targetPercentage.Value()]; } else { params.boostInfo.targetPercentage = nil; } if (mRequest.boostInfo.targetReheat.HasValue()) { params.boostInfo.targetReheat = [NSNumber numberWithUnsignedChar:mRequest.boostInfo.targetReheat.Value()]; } else { params.boostInfo.targetReheat = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster boostWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::WaterHeaterManagement::Commands::Boost::Type mRequest; TypedComplexArgument mComplex_BoostInfo; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command CancelBoost */ class WaterHeaterManagementCancelBoost : public ClusterCommand { public: WaterHeaterManagementCancelBoost() : ClusterCommand("cancel-boost") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WaterHeaterManagement::Commands::CancelBoost::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWaterHeaterManagementClusterCancelBoostParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster cancelBoostWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute HeaterTypes */ class ReadWaterHeaterManagementHeaterTypes : public ReadAttribute { public: ReadWaterHeaterManagementHeaterTypes() : ReadAttribute("heater-types") { } ~ReadWaterHeaterManagementHeaterTypes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::HeaterTypes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeHeaterTypesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.HeaterTypes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterManagement HeaterTypes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterManagementHeaterTypes : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterManagementHeaterTypes() : SubscribeAttribute("heater-types") { } ~SubscribeAttributeWaterHeaterManagementHeaterTypes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::HeaterTypes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeHeaterTypesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.HeaterTypes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute HeatDemand */ class ReadWaterHeaterManagementHeatDemand : public ReadAttribute { public: ReadWaterHeaterManagementHeatDemand() : ReadAttribute("heat-demand") { } ~ReadWaterHeaterManagementHeatDemand() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::HeatDemand::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeHeatDemandWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.HeatDemand response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterManagement HeatDemand read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterManagementHeatDemand : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterManagementHeatDemand() : SubscribeAttribute("heat-demand") { } ~SubscribeAttributeWaterHeaterManagementHeatDemand() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::HeatDemand::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeHeatDemandWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.HeatDemand response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute TankVolume */ class ReadWaterHeaterManagementTankVolume : public ReadAttribute { public: ReadWaterHeaterManagementTankVolume() : ReadAttribute("tank-volume") { } ~ReadWaterHeaterManagementTankVolume() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::TankVolume::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTankVolumeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.TankVolume response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterManagement TankVolume read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterManagementTankVolume : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterManagementTankVolume() : SubscribeAttribute("tank-volume") { } ~SubscribeAttributeWaterHeaterManagementTankVolume() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::TankVolume::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTankVolumeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.TankVolume response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EstimatedHeatRequired */ class ReadWaterHeaterManagementEstimatedHeatRequired : public ReadAttribute { public: ReadWaterHeaterManagementEstimatedHeatRequired() : ReadAttribute("estimated-heat-required") { } ~ReadWaterHeaterManagementEstimatedHeatRequired() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::EstimatedHeatRequired::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEstimatedHeatRequiredWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.EstimatedHeatRequired response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterManagement EstimatedHeatRequired read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterManagementEstimatedHeatRequired : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterManagementEstimatedHeatRequired() : SubscribeAttribute("estimated-heat-required") { } ~SubscribeAttributeWaterHeaterManagementEstimatedHeatRequired() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::EstimatedHeatRequired::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEstimatedHeatRequiredWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.EstimatedHeatRequired response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute TankPercentage */ class ReadWaterHeaterManagementTankPercentage : public ReadAttribute { public: ReadWaterHeaterManagementTankPercentage() : ReadAttribute("tank-percentage") { } ~ReadWaterHeaterManagementTankPercentage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::TankPercentage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTankPercentageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.TankPercentage response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterManagement TankPercentage read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterManagementTankPercentage : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterManagementTankPercentage() : SubscribeAttribute("tank-percentage") { } ~SubscribeAttributeWaterHeaterManagementTankPercentage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::TankPercentage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTankPercentageWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.TankPercentage response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute BoostState */ class ReadWaterHeaterManagementBoostState : public ReadAttribute { public: ReadWaterHeaterManagementBoostState() : ReadAttribute("boost-state") { } ~ReadWaterHeaterManagementBoostState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::BoostState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBoostStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.BoostState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterManagement BoostState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterManagementBoostState : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterManagementBoostState() : SubscribeAttribute("boost-state") { } ~SubscribeAttributeWaterHeaterManagementBoostState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::BoostState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBoostStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.BoostState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadWaterHeaterManagementGeneratedCommandList : public ReadAttribute { public: ReadWaterHeaterManagementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadWaterHeaterManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterManagement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterManagementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterManagementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeWaterHeaterManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadWaterHeaterManagementAcceptedCommandList : public ReadAttribute { public: ReadWaterHeaterManagementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadWaterHeaterManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterManagement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterManagementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterManagementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeWaterHeaterManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadWaterHeaterManagementEventList : public ReadAttribute { public: ReadWaterHeaterManagementEventList() : ReadAttribute("event-list") { } ~ReadWaterHeaterManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterManagement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterManagementEventList : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterManagementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeWaterHeaterManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadWaterHeaterManagementAttributeList : public ReadAttribute { public: ReadWaterHeaterManagementAttributeList() : ReadAttribute("attribute-list") { } ~ReadWaterHeaterManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterManagement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterManagementAttributeList : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterManagementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeWaterHeaterManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadWaterHeaterManagementFeatureMap : public ReadAttribute { public: ReadWaterHeaterManagementFeatureMap() : ReadAttribute("feature-map") { } ~ReadWaterHeaterManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterManagement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterManagementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterManagementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeWaterHeaterManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadWaterHeaterManagementClusterRevision : public ReadAttribute { public: ReadWaterHeaterManagementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadWaterHeaterManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterManagement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterManagementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterManagementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeWaterHeaterManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster DemandResponseLoadControl | 0x0096 | |------------------------------------------------------------------------------| | Commands: | | | * RegisterLoadControlProgramRequest | 0x00 | | * UnregisterLoadControlProgramRequest | 0x01 | | * AddLoadControlEventRequest | 0x02 | | * RemoveLoadControlEventRequest | 0x03 | | * ClearLoadControlEventsRequest | 0x04 | |------------------------------------------------------------------------------| | Attributes: | | | * LoadControlPrograms | 0x0000 | | * NumberOfLoadControlPrograms | 0x0001 | | * Events | 0x0002 | | * ActiveEvents | 0x0003 | | * NumberOfEventsPerProgram | 0x0004 | | * NumberOfTransitions | 0x0005 | | * DefaultRandomStart | 0x0006 | | * DefaultRandomDuration | 0x0007 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * LoadControlEventStatusChange | 0x0000 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command RegisterLoadControlProgramRequest */ class DemandResponseLoadControlRegisterLoadControlProgramRequest : public ClusterCommand { public: DemandResponseLoadControlRegisterLoadControlProgramRequest() : ClusterCommand("register-load-control-program-request") , mComplex_LoadControlProgram(&mRequest.loadControlProgram) { #if MTR_ENABLE_PROVISIONAL AddArgument("LoadControlProgram", &mComplex_LoadControlProgram); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DemandResponseLoadControl::Commands::RegisterLoadControlProgramRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDemandResponseLoadControlClusterRegisterLoadControlProgramRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.loadControlProgram = [MTRDemandResponseLoadControlClusterLoadControlProgramStruct new]; params.loadControlProgram.programID = [NSData dataWithBytes:mRequest.loadControlProgram.programID.data() length:mRequest.loadControlProgram.programID.size()]; params.loadControlProgram.name = [[NSString alloc] initWithBytes:mRequest.loadControlProgram.name.data() length:mRequest.loadControlProgram.name.size() encoding:NSUTF8StringEncoding]; if (mRequest.loadControlProgram.enrollmentGroup.IsNull()) { params.loadControlProgram.enrollmentGroup = nil; } else { params.loadControlProgram.enrollmentGroup = [NSNumber numberWithUnsignedChar:mRequest.loadControlProgram.enrollmentGroup.Value()]; } if (mRequest.loadControlProgram.randomStartMinutes.IsNull()) { params.loadControlProgram.randomStartMinutes = nil; } else { params.loadControlProgram.randomStartMinutes = [NSNumber numberWithUnsignedChar:mRequest.loadControlProgram.randomStartMinutes.Value()]; } if (mRequest.loadControlProgram.randomDurationMinutes.IsNull()) { params.loadControlProgram.randomDurationMinutes = nil; } else { params.loadControlProgram.randomDurationMinutes = [NSNumber numberWithUnsignedChar:mRequest.loadControlProgram.randomDurationMinutes.Value()]; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster registerLoadControlProgramRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DemandResponseLoadControl::Commands::RegisterLoadControlProgramRequest::Type mRequest; TypedComplexArgument mComplex_LoadControlProgram; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command UnregisterLoadControlProgramRequest */ class DemandResponseLoadControlUnregisterLoadControlProgramRequest : public ClusterCommand { public: DemandResponseLoadControlUnregisterLoadControlProgramRequest() : ClusterCommand("unregister-load-control-program-request") { #if MTR_ENABLE_PROVISIONAL AddArgument("LoadControlProgramID", &mRequest.loadControlProgramID); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DemandResponseLoadControl::Commands::UnregisterLoadControlProgramRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDemandResponseLoadControlClusterUnregisterLoadControlProgramRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.loadControlProgramID = [NSData dataWithBytes:mRequest.loadControlProgramID.data() length:mRequest.loadControlProgramID.size()]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster unregisterLoadControlProgramRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DemandResponseLoadControl::Commands::UnregisterLoadControlProgramRequest::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command AddLoadControlEventRequest */ class DemandResponseLoadControlAddLoadControlEventRequest : public ClusterCommand { public: DemandResponseLoadControlAddLoadControlEventRequest() : ClusterCommand("add-load-control-event-request") , mComplex_Event(&mRequest.event) { #if MTR_ENABLE_PROVISIONAL AddArgument("Event", &mComplex_Event); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DemandResponseLoadControl::Commands::AddLoadControlEventRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDemandResponseLoadControlClusterAddLoadControlEventRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.event = [MTRDemandResponseLoadControlClusterLoadControlEventStruct new]; params.event.eventID = [NSData dataWithBytes:mRequest.event.eventID.data() length:mRequest.event.eventID.size()]; if (mRequest.event.programID.IsNull()) { params.event.programID = nil; } else { params.event.programID = [NSData dataWithBytes:mRequest.event.programID.Value().data() length:mRequest.event.programID.Value().size()]; } params.event.control = [NSNumber numberWithUnsignedShort:mRequest.event.control.Raw()]; params.event.deviceClass = [NSNumber numberWithUnsignedInt:mRequest.event.deviceClass.Raw()]; if (mRequest.event.enrollmentGroup.HasValue()) { params.event.enrollmentGroup = [NSNumber numberWithUnsignedChar:mRequest.event.enrollmentGroup.Value()]; } else { params.event.enrollmentGroup = nil; } params.event.criticality = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.event.criticality)]; if (mRequest.event.startTime.IsNull()) { params.event.startTime = nil; } else { params.event.startTime = [NSNumber numberWithUnsignedInt:mRequest.event.startTime.Value()]; } { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.event.transitions) { MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct * newElement_1; newElement_1 = [MTRDemandResponseLoadControlClusterLoadControlEventTransitionStruct new]; newElement_1.duration = [NSNumber numberWithUnsignedShort:entry_1.duration]; newElement_1.control = [NSNumber numberWithUnsignedShort:entry_1.control.Raw()]; if (entry_1.temperatureControl.HasValue()) { newElement_1.temperatureControl = [MTRDemandResponseLoadControlClusterTemperatureControlStruct new]; if (entry_1.temperatureControl.Value().coolingTempOffset.HasValue()) { if (entry_1.temperatureControl.Value().coolingTempOffset.Value().IsNull()) { newElement_1.temperatureControl.coolingTempOffset = nil; } else { newElement_1.temperatureControl.coolingTempOffset = [NSNumber numberWithUnsignedShort:entry_1.temperatureControl.Value().coolingTempOffset.Value().Value()]; } } else { newElement_1.temperatureControl.coolingTempOffset = nil; } if (entry_1.temperatureControl.Value().heatingtTempOffset.HasValue()) { if (entry_1.temperatureControl.Value().heatingtTempOffset.Value().IsNull()) { newElement_1.temperatureControl.heatingtTempOffset = nil; } else { newElement_1.temperatureControl.heatingtTempOffset = [NSNumber numberWithUnsignedShort:entry_1.temperatureControl.Value().heatingtTempOffset.Value().Value()]; } } else { newElement_1.temperatureControl.heatingtTempOffset = nil; } if (entry_1.temperatureControl.Value().coolingTempSetpoint.HasValue()) { if (entry_1.temperatureControl.Value().coolingTempSetpoint.Value().IsNull()) { newElement_1.temperatureControl.coolingTempSetpoint = nil; } else { newElement_1.temperatureControl.coolingTempSetpoint = [NSNumber numberWithShort:entry_1.temperatureControl.Value().coolingTempSetpoint.Value().Value()]; } } else { newElement_1.temperatureControl.coolingTempSetpoint = nil; } if (entry_1.temperatureControl.Value().heatingTempSetpoint.HasValue()) { if (entry_1.temperatureControl.Value().heatingTempSetpoint.Value().IsNull()) { newElement_1.temperatureControl.heatingTempSetpoint = nil; } else { newElement_1.temperatureControl.heatingTempSetpoint = [NSNumber numberWithShort:entry_1.temperatureControl.Value().heatingTempSetpoint.Value().Value()]; } } else { newElement_1.temperatureControl.heatingTempSetpoint = nil; } } else { newElement_1.temperatureControl = nil; } if (entry_1.averageLoadControl.HasValue()) { newElement_1.averageLoadControl = [MTRDemandResponseLoadControlClusterAverageLoadControlStruct new]; newElement_1.averageLoadControl.loadAdjustment = [NSNumber numberWithChar:entry_1.averageLoadControl.Value().loadAdjustment]; } else { newElement_1.averageLoadControl = nil; } if (entry_1.dutyCycleControl.HasValue()) { newElement_1.dutyCycleControl = [MTRDemandResponseLoadControlClusterDutyCycleControlStruct new]; newElement_1.dutyCycleControl.dutyCycle = [NSNumber numberWithUnsignedChar:entry_1.dutyCycleControl.Value().dutyCycle]; } else { newElement_1.dutyCycleControl = nil; } if (entry_1.powerSavingsControl.HasValue()) { newElement_1.powerSavingsControl = [MTRDemandResponseLoadControlClusterPowerSavingsControlStruct new]; newElement_1.powerSavingsControl.powerSavings = [NSNumber numberWithUnsignedChar:entry_1.powerSavingsControl.Value().powerSavings]; } else { newElement_1.powerSavingsControl = nil; } if (entry_1.heatingSourceControl.HasValue()) { newElement_1.heatingSourceControl = [MTRDemandResponseLoadControlClusterHeatingSourceControlStruct new]; newElement_1.heatingSourceControl.heatingSource = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1.heatingSourceControl.Value().heatingSource)]; } else { newElement_1.heatingSourceControl = nil; } [array_1 addObject:newElement_1]; } params.event.transitions = array_1; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster addLoadControlEventRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DemandResponseLoadControl::Commands::AddLoadControlEventRequest::Type mRequest; TypedComplexArgument mComplex_Event; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command RemoveLoadControlEventRequest */ class DemandResponseLoadControlRemoveLoadControlEventRequest : public ClusterCommand { public: DemandResponseLoadControlRemoveLoadControlEventRequest() : ClusterCommand("remove-load-control-event-request") { #if MTR_ENABLE_PROVISIONAL AddArgument("EventID", &mRequest.eventID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("CancelControl", 0, UINT16_MAX, &mRequest.cancelControl); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DemandResponseLoadControl::Commands::RemoveLoadControlEventRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDemandResponseLoadControlClusterRemoveLoadControlEventRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.eventID = [NSData dataWithBytes:mRequest.eventID.data() length:mRequest.eventID.size()]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.cancelControl = [NSNumber numberWithUnsignedShort:mRequest.cancelControl.Raw()]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster removeLoadControlEventRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DemandResponseLoadControl::Commands::RemoveLoadControlEventRequest::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command ClearLoadControlEventsRequest */ class DemandResponseLoadControlClearLoadControlEventsRequest : public ClusterCommand { public: DemandResponseLoadControlClearLoadControlEventsRequest() : ClusterCommand("clear-load-control-events-request") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DemandResponseLoadControl::Commands::ClearLoadControlEventsRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDemandResponseLoadControlClusterClearLoadControlEventsRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster clearLoadControlEventsRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute LoadControlPrograms */ class ReadDemandResponseLoadControlLoadControlPrograms : public ReadAttribute { public: ReadDemandResponseLoadControlLoadControlPrograms() : ReadAttribute("load-control-programs") { } ~ReadDemandResponseLoadControlLoadControlPrograms() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::LoadControlPrograms::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLoadControlProgramsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.LoadControlPrograms response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DemandResponseLoadControl LoadControlPrograms read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDemandResponseLoadControlLoadControlPrograms : public SubscribeAttribute { public: SubscribeAttributeDemandResponseLoadControlLoadControlPrograms() : SubscribeAttribute("load-control-programs") { } ~SubscribeAttributeDemandResponseLoadControlLoadControlPrograms() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::LoadControlPrograms::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLoadControlProgramsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.LoadControlPrograms response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NumberOfLoadControlPrograms */ class ReadDemandResponseLoadControlNumberOfLoadControlPrograms : public ReadAttribute { public: ReadDemandResponseLoadControlNumberOfLoadControlPrograms() : ReadAttribute("number-of-load-control-programs") { } ~ReadDemandResponseLoadControlNumberOfLoadControlPrograms() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::NumberOfLoadControlPrograms::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfLoadControlProgramsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.NumberOfLoadControlPrograms response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DemandResponseLoadControl NumberOfLoadControlPrograms read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDemandResponseLoadControlNumberOfLoadControlPrograms : public SubscribeAttribute { public: SubscribeAttributeDemandResponseLoadControlNumberOfLoadControlPrograms() : SubscribeAttribute("number-of-load-control-programs") { } ~SubscribeAttributeDemandResponseLoadControlNumberOfLoadControlPrograms() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::NumberOfLoadControlPrograms::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfLoadControlProgramsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.NumberOfLoadControlPrograms response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Events */ class ReadDemandResponseLoadControlEvents : public ReadAttribute { public: ReadDemandResponseLoadControlEvents() : ReadAttribute("events") { } ~ReadDemandResponseLoadControlEvents() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::Events::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.Events response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DemandResponseLoadControl Events read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDemandResponseLoadControlEvents : public SubscribeAttribute { public: SubscribeAttributeDemandResponseLoadControlEvents() : SubscribeAttribute("events") { } ~SubscribeAttributeDemandResponseLoadControlEvents() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::Events::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.Events response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ActiveEvents */ class ReadDemandResponseLoadControlActiveEvents : public ReadAttribute { public: ReadDemandResponseLoadControlActiveEvents() : ReadAttribute("active-events") { } ~ReadDemandResponseLoadControlActiveEvents() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::ActiveEvents::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveEventsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.ActiveEvents response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DemandResponseLoadControl ActiveEvents read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDemandResponseLoadControlActiveEvents : public SubscribeAttribute { public: SubscribeAttributeDemandResponseLoadControlActiveEvents() : SubscribeAttribute("active-events") { } ~SubscribeAttributeDemandResponseLoadControlActiveEvents() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::ActiveEvents::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveEventsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.ActiveEvents response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NumberOfEventsPerProgram */ class ReadDemandResponseLoadControlNumberOfEventsPerProgram : public ReadAttribute { public: ReadDemandResponseLoadControlNumberOfEventsPerProgram() : ReadAttribute("number-of-events-per-program") { } ~ReadDemandResponseLoadControlNumberOfEventsPerProgram() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::NumberOfEventsPerProgram::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfEventsPerProgramWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.NumberOfEventsPerProgram response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DemandResponseLoadControl NumberOfEventsPerProgram read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDemandResponseLoadControlNumberOfEventsPerProgram : public SubscribeAttribute { public: SubscribeAttributeDemandResponseLoadControlNumberOfEventsPerProgram() : SubscribeAttribute("number-of-events-per-program") { } ~SubscribeAttributeDemandResponseLoadControlNumberOfEventsPerProgram() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::NumberOfEventsPerProgram::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfEventsPerProgramWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.NumberOfEventsPerProgram response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NumberOfTransitions */ class ReadDemandResponseLoadControlNumberOfTransitions : public ReadAttribute { public: ReadDemandResponseLoadControlNumberOfTransitions() : ReadAttribute("number-of-transitions") { } ~ReadDemandResponseLoadControlNumberOfTransitions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::NumberOfTransitions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfTransitionsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.NumberOfTransitions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DemandResponseLoadControl NumberOfTransitions read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDemandResponseLoadControlNumberOfTransitions : public SubscribeAttribute { public: SubscribeAttributeDemandResponseLoadControlNumberOfTransitions() : SubscribeAttribute("number-of-transitions") { } ~SubscribeAttributeDemandResponseLoadControlNumberOfTransitions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::NumberOfTransitions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfTransitionsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.NumberOfTransitions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute DefaultRandomStart */ class ReadDemandResponseLoadControlDefaultRandomStart : public ReadAttribute { public: ReadDemandResponseLoadControlDefaultRandomStart() : ReadAttribute("default-random-start") { } ~ReadDemandResponseLoadControlDefaultRandomStart() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::DefaultRandomStart::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDefaultRandomStartWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.DefaultRandomStart response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DemandResponseLoadControl DefaultRandomStart read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDemandResponseLoadControlDefaultRandomStart : public WriteAttribute { public: WriteDemandResponseLoadControlDefaultRandomStart() : WriteAttribute("default-random-start") { AddArgument("attr-name", "default-random-start"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDemandResponseLoadControlDefaultRandomStart() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::DefaultRandomStart::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeDefaultRandomStartWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DemandResponseLoadControl DefaultRandomStart write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeDemandResponseLoadControlDefaultRandomStart : public SubscribeAttribute { public: SubscribeAttributeDemandResponseLoadControlDefaultRandomStart() : SubscribeAttribute("default-random-start") { } ~SubscribeAttributeDemandResponseLoadControlDefaultRandomStart() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::DefaultRandomStart::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDefaultRandomStartWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.DefaultRandomStart response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute DefaultRandomDuration */ class ReadDemandResponseLoadControlDefaultRandomDuration : public ReadAttribute { public: ReadDemandResponseLoadControlDefaultRandomDuration() : ReadAttribute("default-random-duration") { } ~ReadDemandResponseLoadControlDefaultRandomDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::DefaultRandomDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDefaultRandomDurationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.DefaultRandomDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DemandResponseLoadControl DefaultRandomDuration read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDemandResponseLoadControlDefaultRandomDuration : public WriteAttribute { public: WriteDemandResponseLoadControlDefaultRandomDuration() : WriteAttribute("default-random-duration") { AddArgument("attr-name", "default-random-duration"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDemandResponseLoadControlDefaultRandomDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::DefaultRandomDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeDefaultRandomDurationWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DemandResponseLoadControl DefaultRandomDuration write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeDemandResponseLoadControlDefaultRandomDuration : public SubscribeAttribute { public: SubscribeAttributeDemandResponseLoadControlDefaultRandomDuration() : SubscribeAttribute("default-random-duration") { } ~SubscribeAttributeDemandResponseLoadControlDefaultRandomDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::DefaultRandomDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDefaultRandomDurationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.DefaultRandomDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadDemandResponseLoadControlGeneratedCommandList : public ReadAttribute { public: ReadDemandResponseLoadControlGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadDemandResponseLoadControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DemandResponseLoadControl GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDemandResponseLoadControlGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeDemandResponseLoadControlGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeDemandResponseLoadControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadDemandResponseLoadControlAcceptedCommandList : public ReadAttribute { public: ReadDemandResponseLoadControlAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadDemandResponseLoadControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DemandResponseLoadControl AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDemandResponseLoadControlAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeDemandResponseLoadControlAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeDemandResponseLoadControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadDemandResponseLoadControlEventList : public ReadAttribute { public: ReadDemandResponseLoadControlEventList() : ReadAttribute("event-list") { } ~ReadDemandResponseLoadControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DemandResponseLoadControl EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDemandResponseLoadControlEventList : public SubscribeAttribute { public: SubscribeAttributeDemandResponseLoadControlEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeDemandResponseLoadControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadDemandResponseLoadControlAttributeList : public ReadAttribute { public: ReadDemandResponseLoadControlAttributeList() : ReadAttribute("attribute-list") { } ~ReadDemandResponseLoadControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DemandResponseLoadControl AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDemandResponseLoadControlAttributeList : public SubscribeAttribute { public: SubscribeAttributeDemandResponseLoadControlAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeDemandResponseLoadControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadDemandResponseLoadControlFeatureMap : public ReadAttribute { public: ReadDemandResponseLoadControlFeatureMap() : ReadAttribute("feature-map") { } ~ReadDemandResponseLoadControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DemandResponseLoadControl FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDemandResponseLoadControlFeatureMap : public SubscribeAttribute { public: SubscribeAttributeDemandResponseLoadControlFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeDemandResponseLoadControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadDemandResponseLoadControlClusterRevision : public ReadAttribute { public: ReadDemandResponseLoadControlClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadDemandResponseLoadControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DemandResponseLoadControl ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDemandResponseLoadControlClusterRevision : public SubscribeAttribute { public: SubscribeAttributeDemandResponseLoadControlClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeDemandResponseLoadControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DemandResponseLoadControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DemandResponseLoadControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDemandResponseLoadControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DemandResponseLoadControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster Messages | 0x0097 | |------------------------------------------------------------------------------| | Commands: | | | * PresentMessagesRequest | 0x00 | | * CancelMessagesRequest | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | | * Messages | 0x0000 | | * ActiveMessageIDs | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * MessageQueued | 0x0000 | | * MessagePresented | 0x0001 | | * MessageComplete | 0x0002 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command PresentMessagesRequest */ class MessagesPresentMessagesRequest : public ClusterCommand { public: MessagesPresentMessagesRequest() : ClusterCommand("present-messages-request") , mComplex_Responses(&mRequest.responses) { #if MTR_ENABLE_PROVISIONAL AddArgument("MessageID", &mRequest.messageID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Priority", 0, UINT8_MAX, &mRequest.priority); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MessageControl", 0, UINT8_MAX, &mRequest.messageControl); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("StartTime", 0, UINT32_MAX, &mRequest.startTime); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Duration", 0, UINT64_MAX, &mRequest.duration); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MessageText", &mRequest.messageText); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Responses", &mComplex_Responses); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Messages::Commands::PresentMessagesRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMessagesClusterPresentMessagesRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.messageID = [NSData dataWithBytes:mRequest.messageID.data() length:mRequest.messageID.size()]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.priority = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.priority)]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.messageControl = [NSNumber numberWithUnsignedChar:mRequest.messageControl.Raw()]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.startTime.IsNull()) { params.startTime = nil; } else { params.startTime = [NSNumber numberWithUnsignedInt:mRequest.startTime.Value()]; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.duration.IsNull()) { params.duration = nil; } else { params.duration = [NSNumber numberWithUnsignedLongLong:mRequest.duration.Value()]; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.messageText = [[NSString alloc] initWithBytes:mRequest.messageText.data() length:mRequest.messageText.size() encoding:NSUTF8StringEncoding]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.responses.HasValue()) { { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.responses.Value()) { MTRMessagesClusterMessageResponseOptionStruct * newElement_1; newElement_1 = [MTRMessagesClusterMessageResponseOptionStruct new]; if (entry_1.messageResponseID.HasValue()) { newElement_1.messageResponseID = [NSNumber numberWithUnsignedInt:entry_1.messageResponseID.Value()]; } else { newElement_1.messageResponseID = nil; } if (entry_1.label.HasValue()) { newElement_1.label = [[NSString alloc] initWithBytes:entry_1.label.Value().data() length:entry_1.label.Value().size() encoding:NSUTF8StringEncoding]; } else { newElement_1.label = nil; } [array_1 addObject:newElement_1]; } params.responses = array_1; } } else { params.responses = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster presentMessagesRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Messages::Commands::PresentMessagesRequest::Type mRequest; TypedComplexArgument>> mComplex_Responses; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command CancelMessagesRequest */ class MessagesCancelMessagesRequest : public ClusterCommand { public: MessagesCancelMessagesRequest() : ClusterCommand("cancel-messages-request") , mComplex_MessageIDs(&mRequest.messageIDs) { #if MTR_ENABLE_PROVISIONAL AddArgument("MessageIDs", &mComplex_MessageIDs); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Messages::Commands::CancelMessagesRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMessagesClusterCancelMessagesRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.messageIDs) { NSData * newElement_0; newElement_0 = [NSData dataWithBytes:entry_0.data() length:entry_0.size()]; [array_0 addObject:newElement_0]; } params.messageIDs = array_0; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster cancelMessagesRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Messages::Commands::CancelMessagesRequest::Type mRequest; TypedComplexArgument> mComplex_MessageIDs; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Messages */ class ReadMessagesMessages : public ReadAttribute { public: ReadMessagesMessages() : ReadAttribute("messages") { } ~ReadMessagesMessages() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Messages::Attributes::Messages::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMessagesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Messages.Messages response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Messages Messages read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMessagesMessages : public SubscribeAttribute { public: SubscribeAttributeMessagesMessages() : SubscribeAttribute("messages") { } ~SubscribeAttributeMessagesMessages() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Messages::Attributes::Messages::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMessagesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Messages.Messages response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ActiveMessageIDs */ class ReadMessagesActiveMessageIDs : public ReadAttribute { public: ReadMessagesActiveMessageIDs() : ReadAttribute("active-message-ids") { } ~ReadMessagesActiveMessageIDs() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Messages::Attributes::ActiveMessageIDs::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveMessageIDsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Messages.ActiveMessageIDs response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Messages ActiveMessageIDs read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMessagesActiveMessageIDs : public SubscribeAttribute { public: SubscribeAttributeMessagesActiveMessageIDs() : SubscribeAttribute("active-message-ids") { } ~SubscribeAttributeMessagesActiveMessageIDs() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Messages::Attributes::ActiveMessageIDs::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveMessageIDsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Messages.ActiveMessageIDs response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadMessagesGeneratedCommandList : public ReadAttribute { public: ReadMessagesGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadMessagesGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Messages::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Messages.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Messages GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMessagesGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeMessagesGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeMessagesGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Messages::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Messages.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadMessagesAcceptedCommandList : public ReadAttribute { public: ReadMessagesAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadMessagesAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Messages::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Messages.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Messages AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMessagesAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeMessagesAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeMessagesAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Messages::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Messages.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadMessagesEventList : public ReadAttribute { public: ReadMessagesEventList() : ReadAttribute("event-list") { } ~ReadMessagesEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Messages::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Messages.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Messages EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMessagesEventList : public SubscribeAttribute { public: SubscribeAttributeMessagesEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeMessagesEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Messages::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Messages.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadMessagesAttributeList : public ReadAttribute { public: ReadMessagesAttributeList() : ReadAttribute("attribute-list") { } ~ReadMessagesAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Messages::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Messages.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Messages AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMessagesAttributeList : public SubscribeAttribute { public: SubscribeAttributeMessagesAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeMessagesAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Messages::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Messages.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadMessagesFeatureMap : public ReadAttribute { public: ReadMessagesFeatureMap() : ReadAttribute("feature-map") { } ~ReadMessagesFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Messages::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Messages.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Messages FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMessagesFeatureMap : public SubscribeAttribute { public: SubscribeAttributeMessagesFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeMessagesFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Messages::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Messages.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadMessagesClusterRevision : public ReadAttribute { public: ReadMessagesClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadMessagesClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Messages::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Messages.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Messages ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMessagesClusterRevision : public SubscribeAttribute { public: SubscribeAttributeMessagesClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeMessagesClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Messages::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Messages::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMessages alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Messages.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster DeviceEnergyManagement | 0x0098 | |------------------------------------------------------------------------------| | Commands: | | | * PowerAdjustRequest | 0x00 | | * CancelPowerAdjustRequest | 0x01 | | * StartTimeAdjustRequest | 0x02 | | * PauseRequest | 0x03 | | * ResumeRequest | 0x04 | | * ModifyForecastRequest | 0x05 | | * RequestConstraintBasedForecast | 0x06 | | * CancelRequest | 0x07 | |------------------------------------------------------------------------------| | Attributes: | | | * ESAType | 0x0000 | | * ESACanGenerate | 0x0001 | | * ESAState | 0x0002 | | * AbsMinPower | 0x0003 | | * AbsMaxPower | 0x0004 | | * PowerAdjustmentCapability | 0x0005 | | * Forecast | 0x0006 | | * OptOutState | 0x0007 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * PowerAdjustStart | 0x0000 | | * PowerAdjustEnd | 0x0001 | | * Paused | 0x0002 | | * Resumed | 0x0003 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command PowerAdjustRequest */ class DeviceEnergyManagementPowerAdjustRequest : public ClusterCommand { public: DeviceEnergyManagementPowerAdjustRequest() : ClusterCommand("power-adjust-request") { #if MTR_ENABLE_PROVISIONAL AddArgument("Power", INT64_MIN, INT64_MAX, &mRequest.power); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Cause", 0, UINT8_MAX, &mRequest.cause); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DeviceEnergyManagement::Commands::PowerAdjustRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDeviceEnergyManagementClusterPowerAdjustRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.power = [NSNumber numberWithLongLong:mRequest.power]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.duration = [NSNumber numberWithUnsignedInt:mRequest.duration]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.cause = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.cause)]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster powerAdjustRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DeviceEnergyManagement::Commands::PowerAdjustRequest::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command CancelPowerAdjustRequest */ class DeviceEnergyManagementCancelPowerAdjustRequest : public ClusterCommand { public: DeviceEnergyManagementCancelPowerAdjustRequest() : ClusterCommand("cancel-power-adjust-request") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DeviceEnergyManagement::Commands::CancelPowerAdjustRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDeviceEnergyManagementClusterCancelPowerAdjustRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster cancelPowerAdjustRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command StartTimeAdjustRequest */ class DeviceEnergyManagementStartTimeAdjustRequest : public ClusterCommand { public: DeviceEnergyManagementStartTimeAdjustRequest() : ClusterCommand("start-time-adjust-request") { #if MTR_ENABLE_PROVISIONAL AddArgument("RequestedStartTime", 0, UINT32_MAX, &mRequest.requestedStartTime); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Cause", 0, UINT8_MAX, &mRequest.cause); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DeviceEnergyManagement::Commands::StartTimeAdjustRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDeviceEnergyManagementClusterStartTimeAdjustRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.requestedStartTime = [NSNumber numberWithUnsignedInt:mRequest.requestedStartTime]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.cause = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.cause)]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster startTimeAdjustRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DeviceEnergyManagement::Commands::StartTimeAdjustRequest::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command PauseRequest */ class DeviceEnergyManagementPauseRequest : public ClusterCommand { public: DeviceEnergyManagementPauseRequest() : ClusterCommand("pause-request") { #if MTR_ENABLE_PROVISIONAL AddArgument("Duration", 0, UINT32_MAX, &mRequest.duration); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Cause", 0, UINT8_MAX, &mRequest.cause); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DeviceEnergyManagement::Commands::PauseRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDeviceEnergyManagementClusterPauseRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.duration = [NSNumber numberWithUnsignedInt:mRequest.duration]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.cause = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.cause)]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster pauseRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DeviceEnergyManagement::Commands::PauseRequest::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command ResumeRequest */ class DeviceEnergyManagementResumeRequest : public ClusterCommand { public: DeviceEnergyManagementResumeRequest() : ClusterCommand("resume-request") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DeviceEnergyManagement::Commands::ResumeRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDeviceEnergyManagementClusterResumeRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster resumeRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command ModifyForecastRequest */ class DeviceEnergyManagementModifyForecastRequest : public ClusterCommand { public: DeviceEnergyManagementModifyForecastRequest() : ClusterCommand("modify-forecast-request") , mComplex_SlotAdjustments(&mRequest.slotAdjustments) { #if MTR_ENABLE_PROVISIONAL AddArgument("ForecastID", 0, UINT32_MAX, &mRequest.forecastID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("SlotAdjustments", &mComplex_SlotAdjustments); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Cause", 0, UINT8_MAX, &mRequest.cause); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DeviceEnergyManagement::Commands::ModifyForecastRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDeviceEnergyManagementClusterModifyForecastRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.forecastID = [NSNumber numberWithUnsignedInt:mRequest.forecastID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.slotAdjustments) { MTRDeviceEnergyManagementClusterSlotAdjustmentStruct * newElement_0; newElement_0 = [MTRDeviceEnergyManagementClusterSlotAdjustmentStruct new]; newElement_0.slotIndex = [NSNumber numberWithUnsignedChar:entry_0.slotIndex]; if (entry_0.nominalPower.HasValue()) { newElement_0.nominalPower = [NSNumber numberWithLongLong:entry_0.nominalPower.Value()]; } else { newElement_0.nominalPower = nil; } newElement_0.duration = [NSNumber numberWithUnsignedInt:entry_0.duration]; [array_0 addObject:newElement_0]; } params.slotAdjustments = array_0; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.cause = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.cause)]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster modifyForecastRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DeviceEnergyManagement::Commands::ModifyForecastRequest::Type mRequest; TypedComplexArgument> mComplex_SlotAdjustments; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command RequestConstraintBasedForecast */ class DeviceEnergyManagementRequestConstraintBasedForecast : public ClusterCommand { public: DeviceEnergyManagementRequestConstraintBasedForecast() : ClusterCommand("request-constraint-based-forecast") , mComplex_Constraints(&mRequest.constraints) { #if MTR_ENABLE_PROVISIONAL AddArgument("Constraints", &mComplex_Constraints); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Cause", 0, UINT8_MAX, &mRequest.cause); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DeviceEnergyManagement::Commands::RequestConstraintBasedForecast::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDeviceEnergyManagementClusterRequestConstraintBasedForecastParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.constraints) { MTRDeviceEnergyManagementClusterConstraintsStruct * newElement_0; newElement_0 = [MTRDeviceEnergyManagementClusterConstraintsStruct new]; newElement_0.startTime = [NSNumber numberWithUnsignedInt:entry_0.startTime]; newElement_0.duration = [NSNumber numberWithUnsignedInt:entry_0.duration]; if (entry_0.nominalPower.HasValue()) { newElement_0.nominalPower = [NSNumber numberWithLongLong:entry_0.nominalPower.Value()]; } else { newElement_0.nominalPower = nil; } if (entry_0.maximumEnergy.HasValue()) { newElement_0.maximumEnergy = [NSNumber numberWithLongLong:entry_0.maximumEnergy.Value()]; } else { newElement_0.maximumEnergy = nil; } if (entry_0.loadControl.HasValue()) { newElement_0.loadControl = [NSNumber numberWithChar:entry_0.loadControl.Value()]; } else { newElement_0.loadControl = nil; } [array_0 addObject:newElement_0]; } params.constraints = array_0; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.cause = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.cause)]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster requestConstraintBasedForecastWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DeviceEnergyManagement::Commands::RequestConstraintBasedForecast::Type mRequest; TypedComplexArgument> mComplex_Constraints; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command CancelRequest */ class DeviceEnergyManagementCancelRequest : public ClusterCommand { public: DeviceEnergyManagementCancelRequest() : ClusterCommand("cancel-request") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DeviceEnergyManagement::Commands::CancelRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDeviceEnergyManagementClusterCancelRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster cancelRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ESAType */ class ReadDeviceEnergyManagementESAType : public ReadAttribute { public: ReadDeviceEnergyManagementESAType() : ReadAttribute("esatype") { } ~ReadDeviceEnergyManagementESAType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::ESAType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeESATypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.ESAType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagement ESAType read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementESAType : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementESAType() : SubscribeAttribute("esatype") { } ~SubscribeAttributeDeviceEnergyManagementESAType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::ESAType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeESATypeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.ESAType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ESACanGenerate */ class ReadDeviceEnergyManagementESACanGenerate : public ReadAttribute { public: ReadDeviceEnergyManagementESACanGenerate() : ReadAttribute("esacan-generate") { } ~ReadDeviceEnergyManagementESACanGenerate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::ESACanGenerate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeESACanGenerateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.ESACanGenerate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagement ESACanGenerate read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementESACanGenerate : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementESACanGenerate() : SubscribeAttribute("esacan-generate") { } ~SubscribeAttributeDeviceEnergyManagementESACanGenerate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::ESACanGenerate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeESACanGenerateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.ESACanGenerate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ESAState */ class ReadDeviceEnergyManagementESAState : public ReadAttribute { public: ReadDeviceEnergyManagementESAState() : ReadAttribute("esastate") { } ~ReadDeviceEnergyManagementESAState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::ESAState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeESAStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.ESAState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagement ESAState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementESAState : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementESAState() : SubscribeAttribute("esastate") { } ~SubscribeAttributeDeviceEnergyManagementESAState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::ESAState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeESAStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.ESAState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AbsMinPower */ class ReadDeviceEnergyManagementAbsMinPower : public ReadAttribute { public: ReadDeviceEnergyManagementAbsMinPower() : ReadAttribute("abs-min-power") { } ~ReadDeviceEnergyManagementAbsMinPower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::AbsMinPower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAbsMinPowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.AbsMinPower response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagement AbsMinPower read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementAbsMinPower : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementAbsMinPower() : SubscribeAttribute("abs-min-power") { } ~SubscribeAttributeDeviceEnergyManagementAbsMinPower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::AbsMinPower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAbsMinPowerWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.AbsMinPower response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AbsMaxPower */ class ReadDeviceEnergyManagementAbsMaxPower : public ReadAttribute { public: ReadDeviceEnergyManagementAbsMaxPower() : ReadAttribute("abs-max-power") { } ~ReadDeviceEnergyManagementAbsMaxPower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::AbsMaxPower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAbsMaxPowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.AbsMaxPower response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagement AbsMaxPower read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementAbsMaxPower : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementAbsMaxPower() : SubscribeAttribute("abs-max-power") { } ~SubscribeAttributeDeviceEnergyManagementAbsMaxPower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::AbsMaxPower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAbsMaxPowerWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.AbsMaxPower response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute PowerAdjustmentCapability */ class ReadDeviceEnergyManagementPowerAdjustmentCapability : public ReadAttribute { public: ReadDeviceEnergyManagementPowerAdjustmentCapability() : ReadAttribute("power-adjustment-capability") { } ~ReadDeviceEnergyManagementPowerAdjustmentCapability() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::PowerAdjustmentCapability::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePowerAdjustmentCapabilityWithCompletion:^(MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.PowerAdjustmentCapability response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagement PowerAdjustmentCapability read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementPowerAdjustmentCapability : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementPowerAdjustmentCapability() : SubscribeAttribute("power-adjustment-capability") { } ~SubscribeAttributeDeviceEnergyManagementPowerAdjustmentCapability() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::PowerAdjustmentCapability::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePowerAdjustmentCapabilityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRDeviceEnergyManagementClusterPowerAdjustCapabilityStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.PowerAdjustmentCapability response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Forecast */ class ReadDeviceEnergyManagementForecast : public ReadAttribute { public: ReadDeviceEnergyManagementForecast() : ReadAttribute("forecast") { } ~ReadDeviceEnergyManagementForecast() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::Forecast::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeForecastWithCompletion:^(MTRDeviceEnergyManagementClusterForecastStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.Forecast response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagement Forecast read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementForecast : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementForecast() : SubscribeAttribute("forecast") { } ~SubscribeAttributeDeviceEnergyManagementForecast() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::Forecast::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeForecastWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRDeviceEnergyManagementClusterForecastStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.Forecast response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute OptOutState */ class ReadDeviceEnergyManagementOptOutState : public ReadAttribute { public: ReadDeviceEnergyManagementOptOutState() : ReadAttribute("opt-out-state") { } ~ReadDeviceEnergyManagementOptOutState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::OptOutState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOptOutStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.OptOutState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagement OptOutState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementOptOutState : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementOptOutState() : SubscribeAttribute("opt-out-state") { } ~SubscribeAttributeDeviceEnergyManagementOptOutState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::OptOutState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOptOutStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.OptOutState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadDeviceEnergyManagementGeneratedCommandList : public ReadAttribute { public: ReadDeviceEnergyManagementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadDeviceEnergyManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeDeviceEnergyManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadDeviceEnergyManagementAcceptedCommandList : public ReadAttribute { public: ReadDeviceEnergyManagementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadDeviceEnergyManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeDeviceEnergyManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadDeviceEnergyManagementEventList : public ReadAttribute { public: ReadDeviceEnergyManagementEventList() : ReadAttribute("event-list") { } ~ReadDeviceEnergyManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementEventList : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeDeviceEnergyManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadDeviceEnergyManagementAttributeList : public ReadAttribute { public: ReadDeviceEnergyManagementAttributeList() : ReadAttribute("attribute-list") { } ~ReadDeviceEnergyManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementAttributeList : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeDeviceEnergyManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadDeviceEnergyManagementFeatureMap : public ReadAttribute { public: ReadDeviceEnergyManagementFeatureMap() : ReadAttribute("feature-map") { } ~ReadDeviceEnergyManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeDeviceEnergyManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadDeviceEnergyManagementClusterRevision : public ReadAttribute { public: ReadDeviceEnergyManagementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadDeviceEnergyManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeDeviceEnergyManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster EnergyEvse | 0x0099 | |------------------------------------------------------------------------------| | Commands: | | | * Disable | 0x01 | | * EnableCharging | 0x02 | | * EnableDischarging | 0x03 | | * StartDiagnostics | 0x04 | | * SetTargets | 0x05 | | * GetTargets | 0x06 | | * ClearTargets | 0x07 | |------------------------------------------------------------------------------| | Attributes: | | | * State | 0x0000 | | * SupplyState | 0x0001 | | * FaultState | 0x0002 | | * ChargingEnabledUntil | 0x0003 | | * DischargingEnabledUntil | 0x0004 | | * CircuitCapacity | 0x0005 | | * MinimumChargeCurrent | 0x0006 | | * MaximumChargeCurrent | 0x0007 | | * MaximumDischargeCurrent | 0x0008 | | * UserMaximumChargeCurrent | 0x0009 | | * RandomizationDelayWindow | 0x000A | | * NextChargeStartTime | 0x0023 | | * NextChargeTargetTime | 0x0024 | | * NextChargeRequiredEnergy | 0x0025 | | * NextChargeTargetSoC | 0x0026 | | * ApproximateEVEfficiency | 0x0027 | | * StateOfCharge | 0x0030 | | * BatteryCapacity | 0x0031 | | * VehicleID | 0x0032 | | * SessionID | 0x0040 | | * SessionDuration | 0x0041 | | * SessionEnergyCharged | 0x0042 | | * SessionEnergyDischarged | 0x0043 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * EVConnected | 0x0000 | | * EVNotDetected | 0x0001 | | * EnergyTransferStarted | 0x0002 | | * EnergyTransferStopped | 0x0003 | | * Fault | 0x0004 | | * Rfid | 0x0005 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command Disable */ class EnergyEvseDisable : public ClusterCommand { public: EnergyEvseDisable() : ClusterCommand("disable") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId commandId = chip::app::Clusters::EnergyEvse::Commands::Disable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTREnergyEVSEClusterDisableParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster disableWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command EnableCharging */ class EnergyEvseEnableCharging : public ClusterCommand { public: EnergyEvseEnableCharging() : ClusterCommand("enable-charging") { #if MTR_ENABLE_PROVISIONAL AddArgument("ChargingEnabledUntil", 0, UINT32_MAX, &mRequest.chargingEnabledUntil); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MinimumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.minimumChargeCurrent); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MaximumChargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumChargeCurrent); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId commandId = chip::app::Clusters::EnergyEvse::Commands::EnableCharging::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTREnergyEVSEClusterEnableChargingParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.chargingEnabledUntil.IsNull()) { params.chargingEnabledUntil = nil; } else { params.chargingEnabledUntil = [NSNumber numberWithUnsignedInt:mRequest.chargingEnabledUntil.Value()]; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.minimumChargeCurrent = [NSNumber numberWithLongLong:mRequest.minimumChargeCurrent]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.maximumChargeCurrent = [NSNumber numberWithLongLong:mRequest.maximumChargeCurrent]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster enableChargingWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::EnergyEvse::Commands::EnableCharging::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command EnableDischarging */ class EnergyEvseEnableDischarging : public ClusterCommand { public: EnergyEvseEnableDischarging() : ClusterCommand("enable-discharging") { #if MTR_ENABLE_PROVISIONAL AddArgument("DischargingEnabledUntil", 0, UINT32_MAX, &mRequest.dischargingEnabledUntil); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MaximumDischargeCurrent", INT64_MIN, INT64_MAX, &mRequest.maximumDischargeCurrent); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId commandId = chip::app::Clusters::EnergyEvse::Commands::EnableDischarging::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTREnergyEVSEClusterEnableDischargingParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.dischargingEnabledUntil.IsNull()) { params.dischargingEnabledUntil = nil; } else { params.dischargingEnabledUntil = [NSNumber numberWithUnsignedInt:mRequest.dischargingEnabledUntil.Value()]; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.maximumDischargeCurrent = [NSNumber numberWithLongLong:mRequest.maximumDischargeCurrent]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster enableDischargingWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::EnergyEvse::Commands::EnableDischarging::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command StartDiagnostics */ class EnergyEvseStartDiagnostics : public ClusterCommand { public: EnergyEvseStartDiagnostics() : ClusterCommand("start-diagnostics") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId commandId = chip::app::Clusters::EnergyEvse::Commands::StartDiagnostics::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTREnergyEVSEClusterStartDiagnosticsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster startDiagnosticsWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetTargets */ class EnergyEvseSetTargets : public ClusterCommand { public: EnergyEvseSetTargets() : ClusterCommand("set-targets") , mComplex_ChargingTargetSchedules(&mRequest.chargingTargetSchedules) { #if MTR_ENABLE_PROVISIONAL AddArgument("ChargingTargetSchedules", &mComplex_ChargingTargetSchedules); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId commandId = chip::app::Clusters::EnergyEvse::Commands::SetTargets::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTREnergyEVSEClusterSetTargetsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.chargingTargetSchedules) { MTREnergyEVSEClusterChargingTargetScheduleStruct * newElement_0; newElement_0 = [MTREnergyEVSEClusterChargingTargetScheduleStruct new]; newElement_0.dayOfWeekForSequence = [NSNumber numberWithUnsignedChar:entry_0.dayOfWeekForSequence.Raw()]; { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.chargingTargets) { MTREnergyEVSEClusterChargingTargetStruct * newElement_2; newElement_2 = [MTREnergyEVSEClusterChargingTargetStruct new]; newElement_2.targetTimeMinutesPastMidnight = [NSNumber numberWithUnsignedShort:entry_2.targetTimeMinutesPastMidnight]; if (entry_2.targetSoC.HasValue()) { newElement_2.targetSoC = [NSNumber numberWithUnsignedChar:entry_2.targetSoC.Value()]; } else { newElement_2.targetSoC = nil; } if (entry_2.addedEnergy.HasValue()) { newElement_2.addedEnergy = [NSNumber numberWithLongLong:entry_2.addedEnergy.Value()]; } else { newElement_2.addedEnergy = nil; } [array_2 addObject:newElement_2]; } newElement_0.chargingTargets = array_2; } [array_0 addObject:newElement_0]; } params.chargingTargetSchedules = array_0; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setTargetsWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::EnergyEvse::Commands::SetTargets::Type mRequest; TypedComplexArgument> mComplex_ChargingTargetSchedules; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command GetTargets */ class EnergyEvseGetTargets : public ClusterCommand { public: EnergyEvseGetTargets() : ClusterCommand("get-targets") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId commandId = chip::app::Clusters::EnergyEvse::Commands::GetTargets::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTREnergyEVSEClusterGetTargetsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster getTargetsWithParams:params completion: ^(MTREnergyEVSEClusterGetTargetsResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::EnergyEvse::Commands::GetTargetsResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::EnergyEvse::Commands::GetTargetsResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command ClearTargets */ class EnergyEvseClearTargets : public ClusterCommand { public: EnergyEvseClearTargets() : ClusterCommand("clear-targets") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId commandId = chip::app::Clusters::EnergyEvse::Commands::ClearTargets::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTREnergyEVSEClusterClearTargetsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster clearTargetsWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute State */ class ReadEnergyEvseState : public ReadAttribute { public: ReadEnergyEvseState() : ReadAttribute("state") { } ~ReadEnergyEvseState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::State::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.State response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE State read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseState : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseState() : SubscribeAttribute("state") { } ~SubscribeAttributeEnergyEvseState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::State::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.State response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupplyState */ class ReadEnergyEvseSupplyState : public ReadAttribute { public: ReadEnergyEvseSupplyState() : ReadAttribute("supply-state") { } ~ReadEnergyEvseSupplyState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::SupplyState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupplyStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.SupplyState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE SupplyState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseSupplyState : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseSupplyState() : SubscribeAttribute("supply-state") { } ~SubscribeAttributeEnergyEvseSupplyState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::SupplyState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupplyStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.SupplyState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FaultState */ class ReadEnergyEvseFaultState : public ReadAttribute { public: ReadEnergyEvseFaultState() : ReadAttribute("fault-state") { } ~ReadEnergyEvseFaultState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::FaultState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFaultStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.FaultState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE FaultState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseFaultState : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseFaultState() : SubscribeAttribute("fault-state") { } ~SubscribeAttributeEnergyEvseFaultState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::FaultState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFaultStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.FaultState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ChargingEnabledUntil */ class ReadEnergyEvseChargingEnabledUntil : public ReadAttribute { public: ReadEnergyEvseChargingEnabledUntil() : ReadAttribute("charging-enabled-until") { } ~ReadEnergyEvseChargingEnabledUntil() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::ChargingEnabledUntil::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeChargingEnabledUntilWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.ChargingEnabledUntil response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE ChargingEnabledUntil read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseChargingEnabledUntil : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseChargingEnabledUntil() : SubscribeAttribute("charging-enabled-until") { } ~SubscribeAttributeEnergyEvseChargingEnabledUntil() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::ChargingEnabledUntil::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeChargingEnabledUntilWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.ChargingEnabledUntil response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute DischargingEnabledUntil */ class ReadEnergyEvseDischargingEnabledUntil : public ReadAttribute { public: ReadEnergyEvseDischargingEnabledUntil() : ReadAttribute("discharging-enabled-until") { } ~ReadEnergyEvseDischargingEnabledUntil() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::DischargingEnabledUntil::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDischargingEnabledUntilWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.DischargingEnabledUntil response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE DischargingEnabledUntil read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseDischargingEnabledUntil : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseDischargingEnabledUntil() : SubscribeAttribute("discharging-enabled-until") { } ~SubscribeAttributeEnergyEvseDischargingEnabledUntil() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::DischargingEnabledUntil::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDischargingEnabledUntilWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.DischargingEnabledUntil response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CircuitCapacity */ class ReadEnergyEvseCircuitCapacity : public ReadAttribute { public: ReadEnergyEvseCircuitCapacity() : ReadAttribute("circuit-capacity") { } ~ReadEnergyEvseCircuitCapacity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::CircuitCapacity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCircuitCapacityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.CircuitCapacity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE CircuitCapacity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseCircuitCapacity : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseCircuitCapacity() : SubscribeAttribute("circuit-capacity") { } ~SubscribeAttributeEnergyEvseCircuitCapacity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::CircuitCapacity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCircuitCapacityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.CircuitCapacity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MinimumChargeCurrent */ class ReadEnergyEvseMinimumChargeCurrent : public ReadAttribute { public: ReadEnergyEvseMinimumChargeCurrent() : ReadAttribute("minimum-charge-current") { } ~ReadEnergyEvseMinimumChargeCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::MinimumChargeCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinimumChargeCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.MinimumChargeCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE MinimumChargeCurrent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseMinimumChargeCurrent : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseMinimumChargeCurrent() : SubscribeAttribute("minimum-charge-current") { } ~SubscribeAttributeEnergyEvseMinimumChargeCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::MinimumChargeCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinimumChargeCurrentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.MinimumChargeCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MaximumChargeCurrent */ class ReadEnergyEvseMaximumChargeCurrent : public ReadAttribute { public: ReadEnergyEvseMaximumChargeCurrent() : ReadAttribute("maximum-charge-current") { } ~ReadEnergyEvseMaximumChargeCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::MaximumChargeCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaximumChargeCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.MaximumChargeCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE MaximumChargeCurrent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseMaximumChargeCurrent : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseMaximumChargeCurrent() : SubscribeAttribute("maximum-charge-current") { } ~SubscribeAttributeEnergyEvseMaximumChargeCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::MaximumChargeCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaximumChargeCurrentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.MaximumChargeCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MaximumDischargeCurrent */ class ReadEnergyEvseMaximumDischargeCurrent : public ReadAttribute { public: ReadEnergyEvseMaximumDischargeCurrent() : ReadAttribute("maximum-discharge-current") { } ~ReadEnergyEvseMaximumDischargeCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::MaximumDischargeCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaximumDischargeCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.MaximumDischargeCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE MaximumDischargeCurrent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseMaximumDischargeCurrent : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseMaximumDischargeCurrent() : SubscribeAttribute("maximum-discharge-current") { } ~SubscribeAttributeEnergyEvseMaximumDischargeCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::MaximumDischargeCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaximumDischargeCurrentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.MaximumDischargeCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute UserMaximumChargeCurrent */ class ReadEnergyEvseUserMaximumChargeCurrent : public ReadAttribute { public: ReadEnergyEvseUserMaximumChargeCurrent() : ReadAttribute("user-maximum-charge-current") { } ~ReadEnergyEvseUserMaximumChargeCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::UserMaximumChargeCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUserMaximumChargeCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.UserMaximumChargeCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE UserMaximumChargeCurrent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteEnergyEvseUserMaximumChargeCurrent : public WriteAttribute { public: WriteEnergyEvseUserMaximumChargeCurrent() : WriteAttribute("user-maximum-charge-current") { AddArgument("attr-name", "user-maximum-charge-current"); AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteEnergyEvseUserMaximumChargeCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::UserMaximumChargeCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithLongLong:mValue]; [cluster writeAttributeUserMaximumChargeCurrentWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("EnergyEVSE UserMaximumChargeCurrent write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int64_t mValue; }; class SubscribeAttributeEnergyEvseUserMaximumChargeCurrent : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseUserMaximumChargeCurrent() : SubscribeAttribute("user-maximum-charge-current") { } ~SubscribeAttributeEnergyEvseUserMaximumChargeCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::UserMaximumChargeCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUserMaximumChargeCurrentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.UserMaximumChargeCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute RandomizationDelayWindow */ class ReadEnergyEvseRandomizationDelayWindow : public ReadAttribute { public: ReadEnergyEvseRandomizationDelayWindow() : ReadAttribute("randomization-delay-window") { } ~ReadEnergyEvseRandomizationDelayWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::RandomizationDelayWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRandomizationDelayWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.RandomizationDelayWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE RandomizationDelayWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteEnergyEvseRandomizationDelayWindow : public WriteAttribute { public: WriteEnergyEvseRandomizationDelayWindow() : WriteAttribute("randomization-delay-window") { AddArgument("attr-name", "randomization-delay-window"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteEnergyEvseRandomizationDelayWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::RandomizationDelayWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; [cluster writeAttributeRandomizationDelayWindowWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("EnergyEVSE RandomizationDelayWindow write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint32_t mValue; }; class SubscribeAttributeEnergyEvseRandomizationDelayWindow : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseRandomizationDelayWindow() : SubscribeAttribute("randomization-delay-window") { } ~SubscribeAttributeEnergyEvseRandomizationDelayWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::RandomizationDelayWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRandomizationDelayWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.RandomizationDelayWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NextChargeStartTime */ class ReadEnergyEvseNextChargeStartTime : public ReadAttribute { public: ReadEnergyEvseNextChargeStartTime() : ReadAttribute("next-charge-start-time") { } ~ReadEnergyEvseNextChargeStartTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::NextChargeStartTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNextChargeStartTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.NextChargeStartTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE NextChargeStartTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseNextChargeStartTime : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseNextChargeStartTime() : SubscribeAttribute("next-charge-start-time") { } ~SubscribeAttributeEnergyEvseNextChargeStartTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::NextChargeStartTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNextChargeStartTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.NextChargeStartTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NextChargeTargetTime */ class ReadEnergyEvseNextChargeTargetTime : public ReadAttribute { public: ReadEnergyEvseNextChargeTargetTime() : ReadAttribute("next-charge-target-time") { } ~ReadEnergyEvseNextChargeTargetTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::NextChargeTargetTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNextChargeTargetTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.NextChargeTargetTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE NextChargeTargetTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseNextChargeTargetTime : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseNextChargeTargetTime() : SubscribeAttribute("next-charge-target-time") { } ~SubscribeAttributeEnergyEvseNextChargeTargetTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::NextChargeTargetTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNextChargeTargetTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.NextChargeTargetTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NextChargeRequiredEnergy */ class ReadEnergyEvseNextChargeRequiredEnergy : public ReadAttribute { public: ReadEnergyEvseNextChargeRequiredEnergy() : ReadAttribute("next-charge-required-energy") { } ~ReadEnergyEvseNextChargeRequiredEnergy() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::NextChargeRequiredEnergy::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNextChargeRequiredEnergyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.NextChargeRequiredEnergy response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE NextChargeRequiredEnergy read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseNextChargeRequiredEnergy : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseNextChargeRequiredEnergy() : SubscribeAttribute("next-charge-required-energy") { } ~SubscribeAttributeEnergyEvseNextChargeRequiredEnergy() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::NextChargeRequiredEnergy::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNextChargeRequiredEnergyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.NextChargeRequiredEnergy response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NextChargeTargetSoC */ class ReadEnergyEvseNextChargeTargetSoC : public ReadAttribute { public: ReadEnergyEvseNextChargeTargetSoC() : ReadAttribute("next-charge-target-so-c") { } ~ReadEnergyEvseNextChargeTargetSoC() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::NextChargeTargetSoC::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNextChargeTargetSoCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.NextChargeTargetSoC response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE NextChargeTargetSoC read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseNextChargeTargetSoC : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseNextChargeTargetSoC() : SubscribeAttribute("next-charge-target-so-c") { } ~SubscribeAttributeEnergyEvseNextChargeTargetSoC() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::NextChargeTargetSoC::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNextChargeTargetSoCWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.NextChargeTargetSoC response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ApproximateEVEfficiency */ class ReadEnergyEvseApproximateEVEfficiency : public ReadAttribute { public: ReadEnergyEvseApproximateEVEfficiency() : ReadAttribute("approximate-evefficiency") { } ~ReadEnergyEvseApproximateEVEfficiency() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::ApproximateEVEfficiency::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeApproximateEVEfficiencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.ApproximateEVEfficiency response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE ApproximateEVEfficiency read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteEnergyEvseApproximateEVEfficiency : public WriteAttribute { public: WriteEnergyEvseApproximateEVEfficiency() : WriteAttribute("approximate-evefficiency") { AddArgument("attr-name", "approximate-evefficiency"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteEnergyEvseApproximateEVEfficiency() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::ApproximateEVEfficiency::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedShort:mValue.Value()]; } [cluster writeAttributeApproximateEVEfficiencyWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("EnergyEVSE ApproximateEVEfficiency write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeEnergyEvseApproximateEVEfficiency : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseApproximateEVEfficiency() : SubscribeAttribute("approximate-evefficiency") { } ~SubscribeAttributeEnergyEvseApproximateEVEfficiency() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::ApproximateEVEfficiency::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeApproximateEVEfficiencyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.ApproximateEVEfficiency response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute StateOfCharge */ class ReadEnergyEvseStateOfCharge : public ReadAttribute { public: ReadEnergyEvseStateOfCharge() : ReadAttribute("state-of-charge") { } ~ReadEnergyEvseStateOfCharge() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::StateOfCharge::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStateOfChargeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.StateOfCharge response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE StateOfCharge read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseStateOfCharge : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseStateOfCharge() : SubscribeAttribute("state-of-charge") { } ~SubscribeAttributeEnergyEvseStateOfCharge() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::StateOfCharge::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStateOfChargeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.StateOfCharge response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute BatteryCapacity */ class ReadEnergyEvseBatteryCapacity : public ReadAttribute { public: ReadEnergyEvseBatteryCapacity() : ReadAttribute("battery-capacity") { } ~ReadEnergyEvseBatteryCapacity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::BatteryCapacity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBatteryCapacityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.BatteryCapacity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE BatteryCapacity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseBatteryCapacity : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseBatteryCapacity() : SubscribeAttribute("battery-capacity") { } ~SubscribeAttributeEnergyEvseBatteryCapacity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::BatteryCapacity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBatteryCapacityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.BatteryCapacity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute VehicleID */ class ReadEnergyEvseVehicleID : public ReadAttribute { public: ReadEnergyEvseVehicleID() : ReadAttribute("vehicle-id") { } ~ReadEnergyEvseVehicleID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::VehicleID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeVehicleIDWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.VehicleID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE VehicleID read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseVehicleID : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseVehicleID() : SubscribeAttribute("vehicle-id") { } ~SubscribeAttributeEnergyEvseVehicleID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::VehicleID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeVehicleIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.VehicleID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SessionID */ class ReadEnergyEvseSessionID : public ReadAttribute { public: ReadEnergyEvseSessionID() : ReadAttribute("session-id") { } ~ReadEnergyEvseSessionID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::SessionID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSessionIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.SessionID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE SessionID read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseSessionID : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseSessionID() : SubscribeAttribute("session-id") { } ~SubscribeAttributeEnergyEvseSessionID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::SessionID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSessionIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.SessionID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SessionDuration */ class ReadEnergyEvseSessionDuration : public ReadAttribute { public: ReadEnergyEvseSessionDuration() : ReadAttribute("session-duration") { } ~ReadEnergyEvseSessionDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::SessionDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSessionDurationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.SessionDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE SessionDuration read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseSessionDuration : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseSessionDuration() : SubscribeAttribute("session-duration") { } ~SubscribeAttributeEnergyEvseSessionDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::SessionDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSessionDurationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.SessionDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SessionEnergyCharged */ class ReadEnergyEvseSessionEnergyCharged : public ReadAttribute { public: ReadEnergyEvseSessionEnergyCharged() : ReadAttribute("session-energy-charged") { } ~ReadEnergyEvseSessionEnergyCharged() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::SessionEnergyCharged::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSessionEnergyChargedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.SessionEnergyCharged response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE SessionEnergyCharged read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseSessionEnergyCharged : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseSessionEnergyCharged() : SubscribeAttribute("session-energy-charged") { } ~SubscribeAttributeEnergyEvseSessionEnergyCharged() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::SessionEnergyCharged::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSessionEnergyChargedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.SessionEnergyCharged response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SessionEnergyDischarged */ class ReadEnergyEvseSessionEnergyDischarged : public ReadAttribute { public: ReadEnergyEvseSessionEnergyDischarged() : ReadAttribute("session-energy-discharged") { } ~ReadEnergyEvseSessionEnergyDischarged() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::SessionEnergyDischarged::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSessionEnergyDischargedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.SessionEnergyDischarged response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE SessionEnergyDischarged read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseSessionEnergyDischarged : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseSessionEnergyDischarged() : SubscribeAttribute("session-energy-discharged") { } ~SubscribeAttributeEnergyEvseSessionEnergyDischarged() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::SessionEnergyDischarged::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSessionEnergyDischargedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.SessionEnergyDischarged response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadEnergyEvseGeneratedCommandList : public ReadAttribute { public: ReadEnergyEvseGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadEnergyEvseGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeEnergyEvseGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadEnergyEvseAcceptedCommandList : public ReadAttribute { public: ReadEnergyEvseAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadEnergyEvseAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeEnergyEvseAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadEnergyEvseEventList : public ReadAttribute { public: ReadEnergyEvseEventList() : ReadAttribute("event-list") { } ~ReadEnergyEvseEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseEventList : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeEnergyEvseEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadEnergyEvseAttributeList : public ReadAttribute { public: ReadEnergyEvseAttributeList() : ReadAttribute("attribute-list") { } ~ReadEnergyEvseAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseAttributeList : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeEnergyEvseAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadEnergyEvseFeatureMap : public ReadAttribute { public: ReadEnergyEvseFeatureMap() : ReadAttribute("feature-map") { } ~ReadEnergyEvseFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseFeatureMap : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeEnergyEvseFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadEnergyEvseClusterRevision : public ReadAttribute { public: ReadEnergyEvseClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadEnergyEvseClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvse::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSE ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseClusterRevision : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeEnergyEvseClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvse::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvse::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSE.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster EnergyPreference | 0x009B | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * EnergyBalances | 0x0000 | | * CurrentEnergyBalance | 0x0001 | | * EnergyPriorities | 0x0002 | | * LowPowerModeSensitivities | 0x0003 | | * CurrentLowPowerModeSensitivity | 0x0004 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Attribute EnergyBalances */ class ReadEnergyPreferenceEnergyBalances : public ReadAttribute { public: ReadEnergyPreferenceEnergyBalances() : ReadAttribute("energy-balances") { } ~ReadEnergyPreferenceEnergyBalances() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyPreference::Attributes::EnergyBalances::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEnergyBalancesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.EnergyBalances response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyPreference EnergyBalances read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyPreferenceEnergyBalances : public SubscribeAttribute { public: SubscribeAttributeEnergyPreferenceEnergyBalances() : SubscribeAttribute("energy-balances") { } ~SubscribeAttributeEnergyPreferenceEnergyBalances() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyPreference::Attributes::EnergyBalances::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEnergyBalancesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.EnergyBalances response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentEnergyBalance */ class ReadEnergyPreferenceCurrentEnergyBalance : public ReadAttribute { public: ReadEnergyPreferenceCurrentEnergyBalance() : ReadAttribute("current-energy-balance") { } ~ReadEnergyPreferenceCurrentEnergyBalance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyPreference::Attributes::CurrentEnergyBalance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentEnergyBalanceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.CurrentEnergyBalance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyPreference CurrentEnergyBalance read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteEnergyPreferenceCurrentEnergyBalance : public WriteAttribute { public: WriteEnergyPreferenceCurrentEnergyBalance() : WriteAttribute("current-energy-balance") { AddArgument("attr-name", "current-energy-balance"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteEnergyPreferenceCurrentEnergyBalance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyPreference::Attributes::CurrentEnergyBalance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeCurrentEnergyBalanceWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("EnergyPreference CurrentEnergyBalance write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeEnergyPreferenceCurrentEnergyBalance : public SubscribeAttribute { public: SubscribeAttributeEnergyPreferenceCurrentEnergyBalance() : SubscribeAttribute("current-energy-balance") { } ~SubscribeAttributeEnergyPreferenceCurrentEnergyBalance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyPreference::Attributes::CurrentEnergyBalance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentEnergyBalanceWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.CurrentEnergyBalance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EnergyPriorities */ class ReadEnergyPreferenceEnergyPriorities : public ReadAttribute { public: ReadEnergyPreferenceEnergyPriorities() : ReadAttribute("energy-priorities") { } ~ReadEnergyPreferenceEnergyPriorities() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyPreference::Attributes::EnergyPriorities::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEnergyPrioritiesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.EnergyPriorities response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyPreference EnergyPriorities read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyPreferenceEnergyPriorities : public SubscribeAttribute { public: SubscribeAttributeEnergyPreferenceEnergyPriorities() : SubscribeAttribute("energy-priorities") { } ~SubscribeAttributeEnergyPreferenceEnergyPriorities() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyPreference::Attributes::EnergyPriorities::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEnergyPrioritiesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.EnergyPriorities response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute LowPowerModeSensitivities */ class ReadEnergyPreferenceLowPowerModeSensitivities : public ReadAttribute { public: ReadEnergyPreferenceLowPowerModeSensitivities() : ReadAttribute("low-power-mode-sensitivities") { } ~ReadEnergyPreferenceLowPowerModeSensitivities() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyPreference::Attributes::LowPowerModeSensitivities::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLowPowerModeSensitivitiesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.LowPowerModeSensitivities response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyPreference LowPowerModeSensitivities read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyPreferenceLowPowerModeSensitivities : public SubscribeAttribute { public: SubscribeAttributeEnergyPreferenceLowPowerModeSensitivities() : SubscribeAttribute("low-power-mode-sensitivities") { } ~SubscribeAttributeEnergyPreferenceLowPowerModeSensitivities() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyPreference::Attributes::LowPowerModeSensitivities::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLowPowerModeSensitivitiesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.LowPowerModeSensitivities response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentLowPowerModeSensitivity */ class ReadEnergyPreferenceCurrentLowPowerModeSensitivity : public ReadAttribute { public: ReadEnergyPreferenceCurrentLowPowerModeSensitivity() : ReadAttribute("current-low-power-mode-sensitivity") { } ~ReadEnergyPreferenceCurrentLowPowerModeSensitivity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyPreference::Attributes::CurrentLowPowerModeSensitivity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentLowPowerModeSensitivityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.CurrentLowPowerModeSensitivity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyPreference CurrentLowPowerModeSensitivity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteEnergyPreferenceCurrentLowPowerModeSensitivity : public WriteAttribute { public: WriteEnergyPreferenceCurrentLowPowerModeSensitivity() : WriteAttribute("current-low-power-mode-sensitivity") { AddArgument("attr-name", "current-low-power-mode-sensitivity"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteEnergyPreferenceCurrentLowPowerModeSensitivity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyPreference::Attributes::CurrentLowPowerModeSensitivity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeCurrentLowPowerModeSensitivityWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("EnergyPreference CurrentLowPowerModeSensitivity write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeEnergyPreferenceCurrentLowPowerModeSensitivity : public SubscribeAttribute { public: SubscribeAttributeEnergyPreferenceCurrentLowPowerModeSensitivity() : SubscribeAttribute("current-low-power-mode-sensitivity") { } ~SubscribeAttributeEnergyPreferenceCurrentLowPowerModeSensitivity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyPreference::Attributes::CurrentLowPowerModeSensitivity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentLowPowerModeSensitivityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.CurrentLowPowerModeSensitivity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadEnergyPreferenceGeneratedCommandList : public ReadAttribute { public: ReadEnergyPreferenceGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadEnergyPreferenceGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyPreference::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyPreference GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyPreferenceGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeEnergyPreferenceGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeEnergyPreferenceGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyPreference::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadEnergyPreferenceAcceptedCommandList : public ReadAttribute { public: ReadEnergyPreferenceAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadEnergyPreferenceAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyPreference::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyPreference AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyPreferenceAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeEnergyPreferenceAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeEnergyPreferenceAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyPreference::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadEnergyPreferenceEventList : public ReadAttribute { public: ReadEnergyPreferenceEventList() : ReadAttribute("event-list") { } ~ReadEnergyPreferenceEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyPreference::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyPreference EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyPreferenceEventList : public SubscribeAttribute { public: SubscribeAttributeEnergyPreferenceEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeEnergyPreferenceEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyPreference::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadEnergyPreferenceAttributeList : public ReadAttribute { public: ReadEnergyPreferenceAttributeList() : ReadAttribute("attribute-list") { } ~ReadEnergyPreferenceAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyPreference::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyPreference AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyPreferenceAttributeList : public SubscribeAttribute { public: SubscribeAttributeEnergyPreferenceAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeEnergyPreferenceAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyPreference::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadEnergyPreferenceFeatureMap : public ReadAttribute { public: ReadEnergyPreferenceFeatureMap() : ReadAttribute("feature-map") { } ~ReadEnergyPreferenceFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyPreference::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyPreference FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyPreferenceFeatureMap : public SubscribeAttribute { public: SubscribeAttributeEnergyPreferenceFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeEnergyPreferenceFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyPreference::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadEnergyPreferenceClusterRevision : public ReadAttribute { public: ReadEnergyPreferenceClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadEnergyPreferenceClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyPreference::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyPreference ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyPreferenceClusterRevision : public SubscribeAttribute { public: SubscribeAttributeEnergyPreferenceClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeEnergyPreferenceClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyPreference::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyPreference::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyPreference alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyPreference.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster PowerTopology | 0x009C | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * AvailableEndpoints | 0x0000 | | * ActiveEndpoints | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Attribute AvailableEndpoints */ class ReadPowerTopologyAvailableEndpoints : public ReadAttribute { public: ReadPowerTopologyAvailableEndpoints() : ReadAttribute("available-endpoints") { } ~ReadPowerTopologyAvailableEndpoints() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerTopology::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerTopology::Attributes::AvailableEndpoints::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerTopology alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAvailableEndpointsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerTopology.AvailableEndpoints response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerTopology AvailableEndpoints read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerTopologyAvailableEndpoints : public SubscribeAttribute { public: SubscribeAttributePowerTopologyAvailableEndpoints() : SubscribeAttribute("available-endpoints") { } ~SubscribeAttributePowerTopologyAvailableEndpoints() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerTopology::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerTopology::Attributes::AvailableEndpoints::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerTopology alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAvailableEndpointsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerTopology.AvailableEndpoints response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ActiveEndpoints */ class ReadPowerTopologyActiveEndpoints : public ReadAttribute { public: ReadPowerTopologyActiveEndpoints() : ReadAttribute("active-endpoints") { } ~ReadPowerTopologyActiveEndpoints() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerTopology::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerTopology::Attributes::ActiveEndpoints::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerTopology alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveEndpointsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerTopology.ActiveEndpoints response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerTopology ActiveEndpoints read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerTopologyActiveEndpoints : public SubscribeAttribute { public: SubscribeAttributePowerTopologyActiveEndpoints() : SubscribeAttribute("active-endpoints") { } ~SubscribeAttributePowerTopologyActiveEndpoints() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerTopology::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerTopology::Attributes::ActiveEndpoints::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerTopology alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveEndpointsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerTopology.ActiveEndpoints response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadPowerTopologyGeneratedCommandList : public ReadAttribute { public: ReadPowerTopologyGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadPowerTopologyGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerTopology::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerTopology::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerTopology alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerTopology.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerTopology GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerTopologyGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributePowerTopologyGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributePowerTopologyGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerTopology::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerTopology::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerTopology alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerTopology.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadPowerTopologyAcceptedCommandList : public ReadAttribute { public: ReadPowerTopologyAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadPowerTopologyAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerTopology::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerTopology::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerTopology alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerTopology.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerTopology AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerTopologyAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributePowerTopologyAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributePowerTopologyAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerTopology::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerTopology::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerTopology alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerTopology.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadPowerTopologyEventList : public ReadAttribute { public: ReadPowerTopologyEventList() : ReadAttribute("event-list") { } ~ReadPowerTopologyEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerTopology::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerTopology::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerTopology alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerTopology.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerTopology EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerTopologyEventList : public SubscribeAttribute { public: SubscribeAttributePowerTopologyEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributePowerTopologyEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerTopology::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerTopology::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerTopology alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerTopology.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadPowerTopologyAttributeList : public ReadAttribute { public: ReadPowerTopologyAttributeList() : ReadAttribute("attribute-list") { } ~ReadPowerTopologyAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerTopology::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerTopology::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerTopology alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerTopology.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerTopology AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerTopologyAttributeList : public SubscribeAttribute { public: SubscribeAttributePowerTopologyAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributePowerTopologyAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerTopology::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerTopology::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerTopology alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerTopology.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadPowerTopologyFeatureMap : public ReadAttribute { public: ReadPowerTopologyFeatureMap() : ReadAttribute("feature-map") { } ~ReadPowerTopologyFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerTopology::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerTopology::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerTopology alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerTopology.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerTopology FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerTopologyFeatureMap : public SubscribeAttribute { public: SubscribeAttributePowerTopologyFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributePowerTopologyFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerTopology::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerTopology::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerTopology alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerTopology.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadPowerTopologyClusterRevision : public ReadAttribute { public: ReadPowerTopologyClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadPowerTopologyClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerTopology::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PowerTopology::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerTopology alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerTopology.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PowerTopology ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePowerTopologyClusterRevision : public SubscribeAttribute { public: SubscribeAttributePowerTopologyClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributePowerTopologyClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PowerTopology::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PowerTopology::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPowerTopology alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerTopology.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster EnergyEvseMode | 0x009D | |------------------------------------------------------------------------------| | Commands: | | | * ChangeToMode | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * SupportedModes | 0x0000 | | * CurrentMode | 0x0001 | | * StartUpMode | 0x0002 | | * OnMode | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command ChangeToMode */ class EnergyEvseModeChangeToMode : public ClusterCommand { public: EnergyEvseModeChangeToMode() : ClusterCommand("change-to-mode") { #if MTR_ENABLE_PROVISIONAL AddArgument("NewMode", 0, UINT8_MAX, &mRequest.newMode); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::CommandId commandId = chip::app::Clusters::EnergyEvseMode::Commands::ChangeToMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTREnergyEVSEModeClusterChangeToModeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.newMode = [NSNumber numberWithUnsignedChar:mRequest.newMode]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster changeToModeWithParams:params completion: ^(MTREnergyEVSEModeClusterChangeToModeResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::EnergyEvseMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::EnergyEvseMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::EnergyEvseMode::Commands::ChangeToMode::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedModes */ class ReadEnergyEvseModeSupportedModes : public ReadAttribute { public: ReadEnergyEvseModeSupportedModes() : ReadAttribute("supported-modes") { } ~ReadEnergyEvseModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedModesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSEMode SupportedModes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseModeSupportedModes : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseModeSupportedModes() : SubscribeAttribute("supported-modes") { } ~SubscribeAttributeEnergyEvseModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedModesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentMode */ class ReadEnergyEvseModeCurrentMode : public ReadAttribute { public: ReadEnergyEvseModeCurrentMode() : ReadAttribute("current-mode") { } ~ReadEnergyEvseModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSEMode CurrentMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseModeCurrentMode : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseModeCurrentMode() : SubscribeAttribute("current-mode") { } ~SubscribeAttributeEnergyEvseModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute StartUpMode */ class ReadEnergyEvseModeStartUpMode : public ReadAttribute { public: ReadEnergyEvseModeStartUpMode() : ReadAttribute("start-up-mode") { } ~ReadEnergyEvseModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStartUpModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.StartUpMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSEMode StartUpMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteEnergyEvseModeStartUpMode : public WriteAttribute { public: WriteEnergyEvseModeStartUpMode() : WriteAttribute("start-up-mode") { AddArgument("attr-name", "start-up-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteEnergyEvseModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeStartUpModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("EnergyEVSEMode StartUpMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeEnergyEvseModeStartUpMode : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseModeStartUpMode() : SubscribeAttribute("start-up-mode") { } ~SubscribeAttributeEnergyEvseModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStartUpModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.StartUpMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute OnMode */ class ReadEnergyEvseModeOnMode : public ReadAttribute { public: ReadEnergyEvseModeOnMode() : ReadAttribute("on-mode") { } ~ReadEnergyEvseModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOnModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.OnMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSEMode OnMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteEnergyEvseModeOnMode : public WriteAttribute { public: WriteEnergyEvseModeOnMode() : WriteAttribute("on-mode") { AddArgument("attr-name", "on-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteEnergyEvseModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeOnModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("EnergyEVSEMode OnMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeEnergyEvseModeOnMode : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseModeOnMode() : SubscribeAttribute("on-mode") { } ~SubscribeAttributeEnergyEvseModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOnModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.OnMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadEnergyEvseModeGeneratedCommandList : public ReadAttribute { public: ReadEnergyEvseModeGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadEnergyEvseModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSEMode GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseModeGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseModeGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeEnergyEvseModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadEnergyEvseModeAcceptedCommandList : public ReadAttribute { public: ReadEnergyEvseModeAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadEnergyEvseModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSEMode AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseModeAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseModeAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeEnergyEvseModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadEnergyEvseModeEventList : public ReadAttribute { public: ReadEnergyEvseModeEventList() : ReadAttribute("event-list") { } ~ReadEnergyEvseModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSEMode EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseModeEventList : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseModeEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeEnergyEvseModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadEnergyEvseModeAttributeList : public ReadAttribute { public: ReadEnergyEvseModeAttributeList() : ReadAttribute("attribute-list") { } ~ReadEnergyEvseModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSEMode AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseModeAttributeList : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseModeAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeEnergyEvseModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadEnergyEvseModeFeatureMap : public ReadAttribute { public: ReadEnergyEvseModeFeatureMap() : ReadAttribute("feature-map") { } ~ReadEnergyEvseModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSEMode FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseModeFeatureMap : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseModeFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeEnergyEvseModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadEnergyEvseModeClusterRevision : public ReadAttribute { public: ReadEnergyEvseModeClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadEnergyEvseModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EnergyEVSEMode ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEnergyEvseModeClusterRevision : public SubscribeAttribute { public: SubscribeAttributeEnergyEvseModeClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeEnergyEvseModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EnergyEvseMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EnergyEvseMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EnergyEVSEMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster WaterHeaterMode | 0x009E | |------------------------------------------------------------------------------| | Commands: | | | * ChangeToMode | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * SupportedModes | 0x0000 | | * CurrentMode | 0x0001 | | * StartUpMode | 0x0002 | | * OnMode | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command ChangeToMode */ class WaterHeaterModeChangeToMode : public ClusterCommand { public: WaterHeaterModeChangeToMode() : ClusterCommand("change-to-mode") { #if MTR_ENABLE_PROVISIONAL AddArgument("NewMode", 0, UINT8_MAX, &mRequest.newMode); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WaterHeaterMode::Commands::ChangeToMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWaterHeaterModeClusterChangeToModeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.newMode = [NSNumber numberWithUnsignedChar:mRequest.newMode]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster changeToModeWithParams:params completion: ^(MTRWaterHeaterModeClusterChangeToModeResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::WaterHeaterMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::WaterHeaterMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::WaterHeaterMode::Commands::ChangeToMode::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedModes */ class ReadWaterHeaterModeSupportedModes : public ReadAttribute { public: ReadWaterHeaterModeSupportedModes() : ReadAttribute("supported-modes") { } ~ReadWaterHeaterModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedModesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterMode SupportedModes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterModeSupportedModes : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterModeSupportedModes() : SubscribeAttribute("supported-modes") { } ~SubscribeAttributeWaterHeaterModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedModesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentMode */ class ReadWaterHeaterModeCurrentMode : public ReadAttribute { public: ReadWaterHeaterModeCurrentMode() : ReadAttribute("current-mode") { } ~ReadWaterHeaterModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterMode CurrentMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterModeCurrentMode : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterModeCurrentMode() : SubscribeAttribute("current-mode") { } ~SubscribeAttributeWaterHeaterModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute StartUpMode */ class ReadWaterHeaterModeStartUpMode : public ReadAttribute { public: ReadWaterHeaterModeStartUpMode() : ReadAttribute("start-up-mode") { } ~ReadWaterHeaterModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStartUpModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.StartUpMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterMode StartUpMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteWaterHeaterModeStartUpMode : public WriteAttribute { public: WriteWaterHeaterModeStartUpMode() : WriteAttribute("start-up-mode") { AddArgument("attr-name", "start-up-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteWaterHeaterModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeStartUpModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("WaterHeaterMode StartUpMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeWaterHeaterModeStartUpMode : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterModeStartUpMode() : SubscribeAttribute("start-up-mode") { } ~SubscribeAttributeWaterHeaterModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStartUpModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.StartUpMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute OnMode */ class ReadWaterHeaterModeOnMode : public ReadAttribute { public: ReadWaterHeaterModeOnMode() : ReadAttribute("on-mode") { } ~ReadWaterHeaterModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOnModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.OnMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterMode OnMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteWaterHeaterModeOnMode : public WriteAttribute { public: WriteWaterHeaterModeOnMode() : WriteAttribute("on-mode") { AddArgument("attr-name", "on-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteWaterHeaterModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeOnModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("WaterHeaterMode OnMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeWaterHeaterModeOnMode : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterModeOnMode() : SubscribeAttribute("on-mode") { } ~SubscribeAttributeWaterHeaterModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOnModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.OnMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadWaterHeaterModeGeneratedCommandList : public ReadAttribute { public: ReadWaterHeaterModeGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadWaterHeaterModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterMode GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterModeGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterModeGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeWaterHeaterModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadWaterHeaterModeAcceptedCommandList : public ReadAttribute { public: ReadWaterHeaterModeAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadWaterHeaterModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterMode AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterModeAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterModeAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeWaterHeaterModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadWaterHeaterModeEventList : public ReadAttribute { public: ReadWaterHeaterModeEventList() : ReadAttribute("event-list") { } ~ReadWaterHeaterModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterMode EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterModeEventList : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterModeEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeWaterHeaterModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadWaterHeaterModeAttributeList : public ReadAttribute { public: ReadWaterHeaterModeAttributeList() : ReadAttribute("attribute-list") { } ~ReadWaterHeaterModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterMode AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterModeAttributeList : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterModeAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeWaterHeaterModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadWaterHeaterModeFeatureMap : public ReadAttribute { public: ReadWaterHeaterModeFeatureMap() : ReadAttribute("feature-map") { } ~ReadWaterHeaterModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterMode FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterModeFeatureMap : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterModeFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeWaterHeaterModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadWaterHeaterModeClusterRevision : public ReadAttribute { public: ReadWaterHeaterModeClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadWaterHeaterModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WaterHeaterMode ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWaterHeaterModeClusterRevision : public SubscribeAttribute { public: SubscribeAttributeWaterHeaterModeClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeWaterHeaterModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WaterHeaterMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WaterHeaterMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWaterHeaterMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WaterHeaterMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster DeviceEnergyManagementMode | 0x009F | |------------------------------------------------------------------------------| | Commands: | | | * ChangeToMode | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * SupportedModes | 0x0000 | | * CurrentMode | 0x0001 | | * StartUpMode | 0x0002 | | * OnMode | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command ChangeToMode */ class DeviceEnergyManagementModeChangeToMode : public ClusterCommand { public: DeviceEnergyManagementModeChangeToMode() : ClusterCommand("change-to-mode") { #if MTR_ENABLE_PROVISIONAL AddArgument("NewMode", 0, UINT8_MAX, &mRequest.newMode); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DeviceEnergyManagementMode::Commands::ChangeToMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDeviceEnergyManagementModeClusterChangeToModeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.newMode = [NSNumber numberWithUnsignedChar:mRequest.newMode]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster changeToModeWithParams:params completion: ^(MTRDeviceEnergyManagementModeClusterChangeToModeResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::DeviceEnergyManagementMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::DeviceEnergyManagementMode::Commands::ChangeToModeResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DeviceEnergyManagementMode::Commands::ChangeToMode::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedModes */ class ReadDeviceEnergyManagementModeSupportedModes : public ReadAttribute { public: ReadDeviceEnergyManagementModeSupportedModes() : ReadAttribute("supported-modes") { } ~ReadDeviceEnergyManagementModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedModesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagementMode SupportedModes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementModeSupportedModes : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementModeSupportedModes() : SubscribeAttribute("supported-modes") { } ~SubscribeAttributeDeviceEnergyManagementModeSupportedModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::SupportedModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedModesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.SupportedModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentMode */ class ReadDeviceEnergyManagementModeCurrentMode : public ReadAttribute { public: ReadDeviceEnergyManagementModeCurrentMode() : ReadAttribute("current-mode") { } ~ReadDeviceEnergyManagementModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagementMode CurrentMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementModeCurrentMode : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementModeCurrentMode() : SubscribeAttribute("current-mode") { } ~SubscribeAttributeDeviceEnergyManagementModeCurrentMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::CurrentMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.CurrentMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute StartUpMode */ class ReadDeviceEnergyManagementModeStartUpMode : public ReadAttribute { public: ReadDeviceEnergyManagementModeStartUpMode() : ReadAttribute("start-up-mode") { } ~ReadDeviceEnergyManagementModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStartUpModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.StartUpMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagementMode StartUpMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDeviceEnergyManagementModeStartUpMode : public WriteAttribute { public: WriteDeviceEnergyManagementModeStartUpMode() : WriteAttribute("start-up-mode") { AddArgument("attr-name", "start-up-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDeviceEnergyManagementModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeStartUpModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DeviceEnergyManagementMode StartUpMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeDeviceEnergyManagementModeStartUpMode : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementModeStartUpMode() : SubscribeAttribute("start-up-mode") { } ~SubscribeAttributeDeviceEnergyManagementModeStartUpMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::StartUpMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStartUpModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.StartUpMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute OnMode */ class ReadDeviceEnergyManagementModeOnMode : public ReadAttribute { public: ReadDeviceEnergyManagementModeOnMode() : ReadAttribute("on-mode") { } ~ReadDeviceEnergyManagementModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOnModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.OnMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagementMode OnMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDeviceEnergyManagementModeOnMode : public WriteAttribute { public: WriteDeviceEnergyManagementModeOnMode() : WriteAttribute("on-mode") { AddArgument("attr-name", "on-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDeviceEnergyManagementModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeOnModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DeviceEnergyManagementMode OnMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeDeviceEnergyManagementModeOnMode : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementModeOnMode() : SubscribeAttribute("on-mode") { } ~SubscribeAttributeDeviceEnergyManagementModeOnMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::OnMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOnModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.OnMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadDeviceEnergyManagementModeGeneratedCommandList : public ReadAttribute { public: ReadDeviceEnergyManagementModeGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadDeviceEnergyManagementModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagementMode GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementModeGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementModeGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeDeviceEnergyManagementModeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadDeviceEnergyManagementModeAcceptedCommandList : public ReadAttribute { public: ReadDeviceEnergyManagementModeAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadDeviceEnergyManagementModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagementMode AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementModeAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementModeAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeDeviceEnergyManagementModeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadDeviceEnergyManagementModeEventList : public ReadAttribute { public: ReadDeviceEnergyManagementModeEventList() : ReadAttribute("event-list") { } ~ReadDeviceEnergyManagementModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagementMode EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementModeEventList : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementModeEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeDeviceEnergyManagementModeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadDeviceEnergyManagementModeAttributeList : public ReadAttribute { public: ReadDeviceEnergyManagementModeAttributeList() : ReadAttribute("attribute-list") { } ~ReadDeviceEnergyManagementModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagementMode AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementModeAttributeList : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementModeAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeDeviceEnergyManagementModeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadDeviceEnergyManagementModeFeatureMap : public ReadAttribute { public: ReadDeviceEnergyManagementModeFeatureMap() : ReadAttribute("feature-map") { } ~ReadDeviceEnergyManagementModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagementMode FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementModeFeatureMap : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementModeFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeDeviceEnergyManagementModeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadDeviceEnergyManagementModeClusterRevision : public ReadAttribute { public: ReadDeviceEnergyManagementModeClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadDeviceEnergyManagementModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DeviceEnergyManagementMode ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDeviceEnergyManagementModeClusterRevision : public SubscribeAttribute { public: SubscribeAttributeDeviceEnergyManagementModeClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeDeviceEnergyManagementModeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DeviceEnergyManagementMode::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DeviceEnergyManagementMode::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DeviceEnergyManagementMode.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster DoorLock | 0x0101 | |------------------------------------------------------------------------------| | Commands: | | | * LockDoor | 0x00 | | * UnlockDoor | 0x01 | | * UnlockWithTimeout | 0x03 | | * SetWeekDaySchedule | 0x0B | | * GetWeekDaySchedule | 0x0C | | * ClearWeekDaySchedule | 0x0D | | * SetYearDaySchedule | 0x0E | | * GetYearDaySchedule | 0x0F | | * ClearYearDaySchedule | 0x10 | | * SetHolidaySchedule | 0x11 | | * GetHolidaySchedule | 0x12 | | * ClearHolidaySchedule | 0x13 | | * SetUser | 0x1A | | * GetUser | 0x1B | | * ClearUser | 0x1D | | * SetCredential | 0x22 | | * GetCredentialStatus | 0x24 | | * ClearCredential | 0x26 | | * UnboltDoor | 0x27 | | * SetAliroReaderConfig | 0x28 | | * ClearAliroReaderConfig | 0x29 | |------------------------------------------------------------------------------| | Attributes: | | | * LockState | 0x0000 | | * LockType | 0x0001 | | * ActuatorEnabled | 0x0002 | | * DoorState | 0x0003 | | * DoorOpenEvents | 0x0004 | | * DoorClosedEvents | 0x0005 | | * OpenPeriod | 0x0006 | | * NumberOfTotalUsersSupported | 0x0011 | | * NumberOfPINUsersSupported | 0x0012 | | * NumberOfRFIDUsersSupported | 0x0013 | | * NumberOfWeekDaySchedulesSupportedPerUser | 0x0014 | | * NumberOfYearDaySchedulesSupportedPerUser | 0x0015 | | * NumberOfHolidaySchedulesSupported | 0x0016 | | * MaxPINCodeLength | 0x0017 | | * MinPINCodeLength | 0x0018 | | * MaxRFIDCodeLength | 0x0019 | | * MinRFIDCodeLength | 0x001A | | * CredentialRulesSupport | 0x001B | | * NumberOfCredentialsSupportedPerUser | 0x001C | | * Language | 0x0021 | | * LEDSettings | 0x0022 | | * AutoRelockTime | 0x0023 | | * SoundVolume | 0x0024 | | * OperatingMode | 0x0025 | | * SupportedOperatingModes | 0x0026 | | * DefaultConfigurationRegister | 0x0027 | | * EnableLocalProgramming | 0x0028 | | * EnableOneTouchLocking | 0x0029 | | * EnableInsideStatusLED | 0x002A | | * EnablePrivacyModeButton | 0x002B | | * LocalProgrammingFeatures | 0x002C | | * WrongCodeEntryLimit | 0x0030 | | * UserCodeTemporaryDisableTime | 0x0031 | | * SendPINOverTheAir | 0x0032 | | * RequirePINforRemoteOperation | 0x0033 | | * ExpiringUserTimeout | 0x0035 | | * AliroReaderVerificationKey | 0x0080 | | * AliroReaderGroupIdentifier | 0x0081 | | * AliroReaderGroupSubIdentifier | 0x0082 | | * AliroExpeditedTransactionSupportedProtocolVersions | 0x0083 | | * AliroGroupResolvingKey | 0x0084 | | * AliroSupportedBLEUWBProtocolVersions | 0x0085 | | * AliroBLEAdvertisingVersion | 0x0086 | | * NumberOfAliroCredentialIssuerKeysSupported | 0x0087 | | * NumberOfAliroEndpointKeysSupported | 0x0088 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * DoorLockAlarm | 0x0000 | | * DoorStateChange | 0x0001 | | * LockOperation | 0x0002 | | * LockOperationError | 0x0003 | | * LockUserChange | 0x0004 | \*----------------------------------------------------------------------------*/ /* * Command LockDoor */ class DoorLockLockDoor : public ClusterCommand { public: DoorLockLockDoor() : ClusterCommand("lock-door") { AddArgument("PINCode", &mRequest.PINCode); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::LockDoor::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterLockDoorParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; if (mRequest.PINCode.HasValue()) { params.pinCode = [NSData dataWithBytes:mRequest.PINCode.Value().data() length:mRequest.PINCode.Value().size()]; } else { params.pinCode = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster lockDoorWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::LockDoor::Type mRequest; }; /* * Command UnlockDoor */ class DoorLockUnlockDoor : public ClusterCommand { public: DoorLockUnlockDoor() : ClusterCommand("unlock-door") { AddArgument("PINCode", &mRequest.PINCode); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::UnlockDoor::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterUnlockDoorParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; if (mRequest.PINCode.HasValue()) { params.pinCode = [NSData dataWithBytes:mRequest.PINCode.Value().data() length:mRequest.PINCode.Value().size()]; } else { params.pinCode = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster unlockDoorWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::UnlockDoor::Type mRequest; }; /* * Command UnlockWithTimeout */ class DoorLockUnlockWithTimeout : public ClusterCommand { public: DoorLockUnlockWithTimeout() : ClusterCommand("unlock-with-timeout") { AddArgument("Timeout", 0, UINT16_MAX, &mRequest.timeout); AddArgument("PINCode", &mRequest.PINCode); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::UnlockWithTimeout::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterUnlockWithTimeoutParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.timeout = [NSNumber numberWithUnsignedShort:mRequest.timeout]; if (mRequest.PINCode.HasValue()) { params.pinCode = [NSData dataWithBytes:mRequest.PINCode.Value().data() length:mRequest.PINCode.Value().size()]; } else { params.pinCode = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster unlockWithTimeoutWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::UnlockWithTimeout::Type mRequest; }; /* * Command SetWeekDaySchedule */ class DoorLockSetWeekDaySchedule : public ClusterCommand { public: DoorLockSetWeekDaySchedule() : ClusterCommand("set-week-day-schedule") { AddArgument("WeekDayIndex", 0, UINT8_MAX, &mRequest.weekDayIndex); AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); AddArgument("DaysMask", 0, UINT8_MAX, &mRequest.daysMask); AddArgument("StartHour", 0, UINT8_MAX, &mRequest.startHour); AddArgument("StartMinute", 0, UINT8_MAX, &mRequest.startMinute); AddArgument("EndHour", 0, UINT8_MAX, &mRequest.endHour); AddArgument("EndMinute", 0, UINT8_MAX, &mRequest.endMinute); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterSetWeekDayScheduleParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.weekDayIndex = [NSNumber numberWithUnsignedChar:mRequest.weekDayIndex]; params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; params.daysMask = [NSNumber numberWithUnsignedChar:mRequest.daysMask.Raw()]; params.startHour = [NSNumber numberWithUnsignedChar:mRequest.startHour]; params.startMinute = [NSNumber numberWithUnsignedChar:mRequest.startMinute]; params.endHour = [NSNumber numberWithUnsignedChar:mRequest.endHour]; params.endMinute = [NSNumber numberWithUnsignedChar:mRequest.endMinute]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setWeekDayScheduleWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::SetWeekDaySchedule::Type mRequest; }; /* * Command GetWeekDaySchedule */ class DoorLockGetWeekDaySchedule : public ClusterCommand { public: DoorLockGetWeekDaySchedule() : ClusterCommand("get-week-day-schedule") { AddArgument("WeekDayIndex", 0, UINT8_MAX, &mRequest.weekDayIndex); AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterGetWeekDayScheduleParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.weekDayIndex = [NSNumber numberWithUnsignedChar:mRequest.weekDayIndex]; params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster getWeekDayScheduleWithParams:params completion: ^(MTRDoorLockClusterGetWeekDayScheduleResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::DoorLock::Commands::GetWeekDayScheduleResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type mRequest; }; /* * Command ClearWeekDaySchedule */ class DoorLockClearWeekDaySchedule : public ClusterCommand { public: DoorLockClearWeekDaySchedule() : ClusterCommand("clear-week-day-schedule") { AddArgument("WeekDayIndex", 0, UINT8_MAX, &mRequest.weekDayIndex); AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterClearWeekDayScheduleParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.weekDayIndex = [NSNumber numberWithUnsignedChar:mRequest.weekDayIndex]; params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster clearWeekDayScheduleWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::ClearWeekDaySchedule::Type mRequest; }; /* * Command SetYearDaySchedule */ class DoorLockSetYearDaySchedule : public ClusterCommand { public: DoorLockSetYearDaySchedule() : ClusterCommand("set-year-day-schedule") { AddArgument("YearDayIndex", 0, UINT8_MAX, &mRequest.yearDayIndex); AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); AddArgument("LocalStartTime", 0, UINT32_MAX, &mRequest.localStartTime); AddArgument("LocalEndTime", 0, UINT32_MAX, &mRequest.localEndTime); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterSetYearDayScheduleParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.yearDayIndex = [NSNumber numberWithUnsignedChar:mRequest.yearDayIndex]; params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; params.localStartTime = [NSNumber numberWithUnsignedInt:mRequest.localStartTime]; params.localEndTime = [NSNumber numberWithUnsignedInt:mRequest.localEndTime]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setYearDayScheduleWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::SetYearDaySchedule::Type mRequest; }; /* * Command GetYearDaySchedule */ class DoorLockGetYearDaySchedule : public ClusterCommand { public: DoorLockGetYearDaySchedule() : ClusterCommand("get-year-day-schedule") { AddArgument("YearDayIndex", 0, UINT8_MAX, &mRequest.yearDayIndex); AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterGetYearDayScheduleParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.yearDayIndex = [NSNumber numberWithUnsignedChar:mRequest.yearDayIndex]; params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster getYearDayScheduleWithParams:params completion: ^(MTRDoorLockClusterGetYearDayScheduleResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::DoorLock::Commands::GetYearDayScheduleResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type mRequest; }; /* * Command ClearYearDaySchedule */ class DoorLockClearYearDaySchedule : public ClusterCommand { public: DoorLockClearYearDaySchedule() : ClusterCommand("clear-year-day-schedule") { AddArgument("YearDayIndex", 0, UINT8_MAX, &mRequest.yearDayIndex); AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterClearYearDayScheduleParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.yearDayIndex = [NSNumber numberWithUnsignedChar:mRequest.yearDayIndex]; params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster clearYearDayScheduleWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::ClearYearDaySchedule::Type mRequest; }; /* * Command SetHolidaySchedule */ class DoorLockSetHolidaySchedule : public ClusterCommand { public: DoorLockSetHolidaySchedule() : ClusterCommand("set-holiday-schedule") { AddArgument("HolidayIndex", 0, UINT8_MAX, &mRequest.holidayIndex); AddArgument("LocalStartTime", 0, UINT32_MAX, &mRequest.localStartTime); AddArgument("LocalEndTime", 0, UINT32_MAX, &mRequest.localEndTime); AddArgument("OperatingMode", 0, UINT8_MAX, &mRequest.operatingMode); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::SetHolidaySchedule::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterSetHolidayScheduleParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.holidayIndex = [NSNumber numberWithUnsignedChar:mRequest.holidayIndex]; params.localStartTime = [NSNumber numberWithUnsignedInt:mRequest.localStartTime]; params.localEndTime = [NSNumber numberWithUnsignedInt:mRequest.localEndTime]; params.operatingMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.operatingMode)]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setHolidayScheduleWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::SetHolidaySchedule::Type mRequest; }; /* * Command GetHolidaySchedule */ class DoorLockGetHolidaySchedule : public ClusterCommand { public: DoorLockGetHolidaySchedule() : ClusterCommand("get-holiday-schedule") { AddArgument("HolidayIndex", 0, UINT8_MAX, &mRequest.holidayIndex); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterGetHolidayScheduleParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.holidayIndex = [NSNumber numberWithUnsignedChar:mRequest.holidayIndex]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster getHolidayScheduleWithParams:params completion: ^(MTRDoorLockClusterGetHolidayScheduleResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::DoorLock::Commands::GetHolidayScheduleResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type mRequest; }; /* * Command ClearHolidaySchedule */ class DoorLockClearHolidaySchedule : public ClusterCommand { public: DoorLockClearHolidaySchedule() : ClusterCommand("clear-holiday-schedule") { AddArgument("HolidayIndex", 0, UINT8_MAX, &mRequest.holidayIndex); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::ClearHolidaySchedule::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterClearHolidayScheduleParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.holidayIndex = [NSNumber numberWithUnsignedChar:mRequest.holidayIndex]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster clearHolidayScheduleWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::ClearHolidaySchedule::Type mRequest; }; /* * Command SetUser */ class DoorLockSetUser : public ClusterCommand { public: DoorLockSetUser() : ClusterCommand("set-user") { AddArgument("OperationType", 0, UINT8_MAX, &mRequest.operationType); AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); AddArgument("UserName", &mRequest.userName); AddArgument("UserUniqueID", 0, UINT32_MAX, &mRequest.userUniqueID); AddArgument("UserStatus", 0, UINT8_MAX, &mRequest.userStatus); AddArgument("UserType", 0, UINT8_MAX, &mRequest.userType); AddArgument("CredentialRule", 0, UINT8_MAX, &mRequest.credentialRule); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::SetUser::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterSetUserParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.operationType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.operationType)]; params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; if (mRequest.userName.IsNull()) { params.userName = nil; } else { params.userName = [[NSString alloc] initWithBytes:mRequest.userName.Value().data() length:mRequest.userName.Value().size() encoding:NSUTF8StringEncoding]; } if (mRequest.userUniqueID.IsNull()) { params.userUniqueID = nil; } else { params.userUniqueID = [NSNumber numberWithUnsignedInt:mRequest.userUniqueID.Value()]; } if (mRequest.userStatus.IsNull()) { params.userStatus = nil; } else { params.userStatus = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.userStatus.Value())]; } if (mRequest.userType.IsNull()) { params.userType = nil; } else { params.userType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.userType.Value())]; } if (mRequest.credentialRule.IsNull()) { params.credentialRule = nil; } else { params.credentialRule = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.credentialRule.Value())]; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setUserWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::SetUser::Type mRequest; }; /* * Command GetUser */ class DoorLockGetUser : public ClusterCommand { public: DoorLockGetUser() : ClusterCommand("get-user") { AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::GetUser::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterGetUserParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster getUserWithParams:params completion: ^(MTRDoorLockClusterGetUserResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::DoorLock::Commands::GetUserResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::DoorLock::Commands::GetUserResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::GetUser::Type mRequest; }; /* * Command ClearUser */ class DoorLockClearUser : public ClusterCommand { public: DoorLockClearUser() : ClusterCommand("clear-user") { AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::ClearUser::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterClearUserParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster clearUserWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::ClearUser::Type mRequest; }; /* * Command SetCredential */ class DoorLockSetCredential : public ClusterCommand { public: DoorLockSetCredential() : ClusterCommand("set-credential") , mComplex_Credential(&mRequest.credential) { AddArgument("OperationType", 0, UINT8_MAX, &mRequest.operationType); AddArgument("Credential", &mComplex_Credential); AddArgument("CredentialData", &mRequest.credentialData); AddArgument("UserIndex", 0, UINT16_MAX, &mRequest.userIndex); AddArgument("UserStatus", 0, UINT8_MAX, &mRequest.userStatus); AddArgument("UserType", 0, UINT8_MAX, &mRequest.userType); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::SetCredential::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterSetCredentialParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.operationType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.operationType)]; params.credential = [MTRDoorLockClusterCredentialStruct new]; params.credential.credentialType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.credential.credentialType)]; params.credential.credentialIndex = [NSNumber numberWithUnsignedShort:mRequest.credential.credentialIndex]; params.credentialData = [NSData dataWithBytes:mRequest.credentialData.data() length:mRequest.credentialData.size()]; if (mRequest.userIndex.IsNull()) { params.userIndex = nil; } else { params.userIndex = [NSNumber numberWithUnsignedShort:mRequest.userIndex.Value()]; } if (mRequest.userStatus.IsNull()) { params.userStatus = nil; } else { params.userStatus = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.userStatus.Value())]; } if (mRequest.userType.IsNull()) { params.userType = nil; } else { params.userType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.userType.Value())]; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setCredentialWithParams:params completion: ^(MTRDoorLockClusterSetCredentialResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::DoorLock::Commands::SetCredentialResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::SetCredential::Type mRequest; TypedComplexArgument mComplex_Credential; }; /* * Command GetCredentialStatus */ class DoorLockGetCredentialStatus : public ClusterCommand { public: DoorLockGetCredentialStatus() : ClusterCommand("get-credential-status") , mComplex_Credential(&mRequest.credential) { AddArgument("Credential", &mComplex_Credential); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterGetCredentialStatusParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.credential = [MTRDoorLockClusterCredentialStruct new]; params.credential.credentialType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.credential.credentialType)]; params.credential.credentialIndex = [NSNumber numberWithUnsignedShort:mRequest.credential.credentialIndex]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster getCredentialStatusWithParams:params completion: ^(MTRDoorLockClusterGetCredentialStatusResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::DoorLock::Commands::GetCredentialStatusResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type mRequest; TypedComplexArgument mComplex_Credential; }; /* * Command ClearCredential */ class DoorLockClearCredential : public ClusterCommand { public: DoorLockClearCredential() : ClusterCommand("clear-credential") , mComplex_Credential(&mRequest.credential) { AddArgument("Credential", &mComplex_Credential); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::ClearCredential::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterClearCredentialParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; if (mRequest.credential.IsNull()) { params.credential = nil; } else { params.credential = [MTRDoorLockClusterCredentialStruct new]; params.credential.credentialType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.credential.Value().credentialType)]; params.credential.credentialIndex = [NSNumber numberWithUnsignedShort:mRequest.credential.Value().credentialIndex]; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster clearCredentialWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::ClearCredential::Type mRequest; TypedComplexArgument> mComplex_Credential; }; #if MTR_ENABLE_PROVISIONAL /* * Command UnboltDoor */ class DoorLockUnboltDoor : public ClusterCommand { public: DoorLockUnboltDoor() : ClusterCommand("unbolt-door") { #if MTR_ENABLE_PROVISIONAL AddArgument("PINCode", &mRequest.PINCode); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::UnboltDoor::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterUnboltDoorParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.PINCode.HasValue()) { params.pinCode = [NSData dataWithBytes:mRequest.PINCode.Value().data() length:mRequest.PINCode.Value().size()]; } else { params.pinCode = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster unboltDoorWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::UnboltDoor::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetAliroReaderConfig */ class DoorLockSetAliroReaderConfig : public ClusterCommand { public: DoorLockSetAliroReaderConfig() : ClusterCommand("set-aliro-reader-config") { #if MTR_ENABLE_PROVISIONAL AddArgument("SigningKey", &mRequest.signingKey); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("VerificationKey", &mRequest.verificationKey); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("GroupIdentifier", &mRequest.groupIdentifier); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("GroupResolvingKey", &mRequest.groupResolvingKey); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::SetAliroReaderConfig::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterSetAliroReaderConfigParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.signingKey = [NSData dataWithBytes:mRequest.signingKey.data() length:mRequest.signingKey.size()]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.verificationKey = [NSData dataWithBytes:mRequest.verificationKey.data() length:mRequest.verificationKey.size()]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.groupIdentifier = [NSData dataWithBytes:mRequest.groupIdentifier.data() length:mRequest.groupIdentifier.size()]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.groupResolvingKey.HasValue()) { params.groupResolvingKey = [NSData dataWithBytes:mRequest.groupResolvingKey.Value().data() length:mRequest.groupResolvingKey.Value().size()]; } else { params.groupResolvingKey = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setAliroReaderConfigWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::DoorLock::Commands::SetAliroReaderConfig::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command ClearAliroReaderConfig */ class DoorLockClearAliroReaderConfig : public ClusterCommand { public: DoorLockClearAliroReaderConfig() : ClusterCommand("clear-aliro-reader-config") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId commandId = chip::app::Clusters::DoorLock::Commands::ClearAliroReaderConfig::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRDoorLockClusterClearAliroReaderConfigParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster clearAliroReaderConfigWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute LockState */ class ReadDoorLockLockState : public ReadAttribute { public: ReadDoorLockLockState() : ReadAttribute("lock-state") { } ~ReadDoorLockLockState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::LockState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLockStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.LockState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock LockState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockLockState : public SubscribeAttribute { public: SubscribeAttributeDoorLockLockState() : SubscribeAttribute("lock-state") { } ~SubscribeAttributeDoorLockLockState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::LockState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLockStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.LockState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LockType */ class ReadDoorLockLockType : public ReadAttribute { public: ReadDoorLockLockType() : ReadAttribute("lock-type") { } ~ReadDoorLockLockType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::LockType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLockTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.LockType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock LockType read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockLockType : public SubscribeAttribute { public: SubscribeAttributeDoorLockLockType() : SubscribeAttribute("lock-type") { } ~SubscribeAttributeDoorLockLockType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::LockType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLockTypeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.LockType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ActuatorEnabled */ class ReadDoorLockActuatorEnabled : public ReadAttribute { public: ReadDoorLockActuatorEnabled() : ReadAttribute("actuator-enabled") { } ~ReadDoorLockActuatorEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::ActuatorEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActuatorEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.ActuatorEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock ActuatorEnabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockActuatorEnabled : public SubscribeAttribute { public: SubscribeAttributeDoorLockActuatorEnabled() : SubscribeAttribute("actuator-enabled") { } ~SubscribeAttributeDoorLockActuatorEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::ActuatorEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActuatorEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.ActuatorEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute DoorState */ class ReadDoorLockDoorState : public ReadAttribute { public: ReadDoorLockDoorState() : ReadAttribute("door-state") { } ~ReadDoorLockDoorState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::DoorState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDoorStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.DoorState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock DoorState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockDoorState : public SubscribeAttribute { public: SubscribeAttributeDoorLockDoorState() : SubscribeAttribute("door-state") { } ~SubscribeAttributeDoorLockDoorState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::DoorState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDoorStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.DoorState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute DoorOpenEvents */ class ReadDoorLockDoorOpenEvents : public ReadAttribute { public: ReadDoorLockDoorOpenEvents() : ReadAttribute("door-open-events") { } ~ReadDoorLockDoorOpenEvents() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::DoorOpenEvents::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDoorOpenEventsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.DoorOpenEvents response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock DoorOpenEvents read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockDoorOpenEvents : public WriteAttribute { public: WriteDoorLockDoorOpenEvents() : WriteAttribute("door-open-events") { AddArgument("attr-name", "door-open-events"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockDoorOpenEvents() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::DoorOpenEvents::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; [cluster writeAttributeDoorOpenEventsWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock DoorOpenEvents write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint32_t mValue; }; class SubscribeAttributeDoorLockDoorOpenEvents : public SubscribeAttribute { public: SubscribeAttributeDoorLockDoorOpenEvents() : SubscribeAttribute("door-open-events") { } ~SubscribeAttributeDoorLockDoorOpenEvents() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::DoorOpenEvents::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDoorOpenEventsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.DoorOpenEvents response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute DoorClosedEvents */ class ReadDoorLockDoorClosedEvents : public ReadAttribute { public: ReadDoorLockDoorClosedEvents() : ReadAttribute("door-closed-events") { } ~ReadDoorLockDoorClosedEvents() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::DoorClosedEvents::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDoorClosedEventsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.DoorClosedEvents response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock DoorClosedEvents read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockDoorClosedEvents : public WriteAttribute { public: WriteDoorLockDoorClosedEvents() : WriteAttribute("door-closed-events") { AddArgument("attr-name", "door-closed-events"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockDoorClosedEvents() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::DoorClosedEvents::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; [cluster writeAttributeDoorClosedEventsWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock DoorClosedEvents write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint32_t mValue; }; class SubscribeAttributeDoorLockDoorClosedEvents : public SubscribeAttribute { public: SubscribeAttributeDoorLockDoorClosedEvents() : SubscribeAttribute("door-closed-events") { } ~SubscribeAttributeDoorLockDoorClosedEvents() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::DoorClosedEvents::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDoorClosedEventsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.DoorClosedEvents response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OpenPeriod */ class ReadDoorLockOpenPeriod : public ReadAttribute { public: ReadDoorLockOpenPeriod() : ReadAttribute("open-period") { } ~ReadDoorLockOpenPeriod() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::OpenPeriod::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOpenPeriodWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.OpenPeriod response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock OpenPeriod read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockOpenPeriod : public WriteAttribute { public: WriteDoorLockOpenPeriod() : WriteAttribute("open-period") { AddArgument("attr-name", "open-period"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockOpenPeriod() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::OpenPeriod::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeOpenPeriodWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock OpenPeriod write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeDoorLockOpenPeriod : public SubscribeAttribute { public: SubscribeAttributeDoorLockOpenPeriod() : SubscribeAttribute("open-period") { } ~SubscribeAttributeDoorLockOpenPeriod() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::OpenPeriod::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOpenPeriodWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.OpenPeriod response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NumberOfTotalUsersSupported */ class ReadDoorLockNumberOfTotalUsersSupported : public ReadAttribute { public: ReadDoorLockNumberOfTotalUsersSupported() : ReadAttribute("number-of-total-users-supported") { } ~ReadDoorLockNumberOfTotalUsersSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfTotalUsersSupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfTotalUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfTotalUsersSupported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock NumberOfTotalUsersSupported read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockNumberOfTotalUsersSupported : public SubscribeAttribute { public: SubscribeAttributeDoorLockNumberOfTotalUsersSupported() : SubscribeAttribute("number-of-total-users-supported") { } ~SubscribeAttributeDoorLockNumberOfTotalUsersSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfTotalUsersSupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfTotalUsersSupportedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfTotalUsersSupported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NumberOfPINUsersSupported */ class ReadDoorLockNumberOfPINUsersSupported : public ReadAttribute { public: ReadDoorLockNumberOfPINUsersSupported() : ReadAttribute("number-of-pinusers-supported") { } ~ReadDoorLockNumberOfPINUsersSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfPINUsersSupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfPINUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfPINUsersSupported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock NumberOfPINUsersSupported read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockNumberOfPINUsersSupported : public SubscribeAttribute { public: SubscribeAttributeDoorLockNumberOfPINUsersSupported() : SubscribeAttribute("number-of-pinusers-supported") { } ~SubscribeAttributeDoorLockNumberOfPINUsersSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfPINUsersSupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfPINUsersSupportedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfPINUsersSupported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NumberOfRFIDUsersSupported */ class ReadDoorLockNumberOfRFIDUsersSupported : public ReadAttribute { public: ReadDoorLockNumberOfRFIDUsersSupported() : ReadAttribute("number-of-rfidusers-supported") { } ~ReadDoorLockNumberOfRFIDUsersSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfRFIDUsersSupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfRFIDUsersSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfRFIDUsersSupported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock NumberOfRFIDUsersSupported read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockNumberOfRFIDUsersSupported : public SubscribeAttribute { public: SubscribeAttributeDoorLockNumberOfRFIDUsersSupported() : SubscribeAttribute("number-of-rfidusers-supported") { } ~SubscribeAttributeDoorLockNumberOfRFIDUsersSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfRFIDUsersSupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfRFIDUsersSupportedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfRFIDUsersSupported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NumberOfWeekDaySchedulesSupportedPerUser */ class ReadDoorLockNumberOfWeekDaySchedulesSupportedPerUser : public ReadAttribute { public: ReadDoorLockNumberOfWeekDaySchedulesSupportedPerUser() : ReadAttribute("number-of-week-day-schedules-supported-per-user") { } ~ReadDoorLockNumberOfWeekDaySchedulesSupportedPerUser() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfWeekDaySchedulesSupportedPerUser::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfWeekDaySchedulesSupportedPerUserWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfWeekDaySchedulesSupportedPerUser response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock NumberOfWeekDaySchedulesSupportedPerUser read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockNumberOfWeekDaySchedulesSupportedPerUser : public SubscribeAttribute { public: SubscribeAttributeDoorLockNumberOfWeekDaySchedulesSupportedPerUser() : SubscribeAttribute("number-of-week-day-schedules-supported-per-user") { } ~SubscribeAttributeDoorLockNumberOfWeekDaySchedulesSupportedPerUser() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfWeekDaySchedulesSupportedPerUser::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfWeekDaySchedulesSupportedPerUserWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfWeekDaySchedulesSupportedPerUser response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NumberOfYearDaySchedulesSupportedPerUser */ class ReadDoorLockNumberOfYearDaySchedulesSupportedPerUser : public ReadAttribute { public: ReadDoorLockNumberOfYearDaySchedulesSupportedPerUser() : ReadAttribute("number-of-year-day-schedules-supported-per-user") { } ~ReadDoorLockNumberOfYearDaySchedulesSupportedPerUser() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfYearDaySchedulesSupportedPerUser::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfYearDaySchedulesSupportedPerUserWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfYearDaySchedulesSupportedPerUser response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock NumberOfYearDaySchedulesSupportedPerUser read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockNumberOfYearDaySchedulesSupportedPerUser : public SubscribeAttribute { public: SubscribeAttributeDoorLockNumberOfYearDaySchedulesSupportedPerUser() : SubscribeAttribute("number-of-year-day-schedules-supported-per-user") { } ~SubscribeAttributeDoorLockNumberOfYearDaySchedulesSupportedPerUser() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfYearDaySchedulesSupportedPerUser::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfYearDaySchedulesSupportedPerUserWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfYearDaySchedulesSupportedPerUser response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NumberOfHolidaySchedulesSupported */ class ReadDoorLockNumberOfHolidaySchedulesSupported : public ReadAttribute { public: ReadDoorLockNumberOfHolidaySchedulesSupported() : ReadAttribute("number-of-holiday-schedules-supported") { } ~ReadDoorLockNumberOfHolidaySchedulesSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfHolidaySchedulesSupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfHolidaySchedulesSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfHolidaySchedulesSupported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock NumberOfHolidaySchedulesSupported read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockNumberOfHolidaySchedulesSupported : public SubscribeAttribute { public: SubscribeAttributeDoorLockNumberOfHolidaySchedulesSupported() : SubscribeAttribute("number-of-holiday-schedules-supported") { } ~SubscribeAttributeDoorLockNumberOfHolidaySchedulesSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfHolidaySchedulesSupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfHolidaySchedulesSupportedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfHolidaySchedulesSupported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxPINCodeLength */ class ReadDoorLockMaxPINCodeLength : public ReadAttribute { public: ReadDoorLockMaxPINCodeLength() : ReadAttribute("max-pincode-length") { } ~ReadDoorLockMaxPINCodeLength() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::MaxPINCodeLength::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxPINCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.MaxPINCodeLength response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock MaxPINCodeLength read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockMaxPINCodeLength : public SubscribeAttribute { public: SubscribeAttributeDoorLockMaxPINCodeLength() : SubscribeAttribute("max-pincode-length") { } ~SubscribeAttributeDoorLockMaxPINCodeLength() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::MaxPINCodeLength::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxPINCodeLengthWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.MaxPINCodeLength response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinPINCodeLength */ class ReadDoorLockMinPINCodeLength : public ReadAttribute { public: ReadDoorLockMinPINCodeLength() : ReadAttribute("min-pincode-length") { } ~ReadDoorLockMinPINCodeLength() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::MinPINCodeLength::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinPINCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.MinPINCodeLength response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock MinPINCodeLength read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockMinPINCodeLength : public SubscribeAttribute { public: SubscribeAttributeDoorLockMinPINCodeLength() : SubscribeAttribute("min-pincode-length") { } ~SubscribeAttributeDoorLockMinPINCodeLength() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::MinPINCodeLength::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinPINCodeLengthWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.MinPINCodeLength response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxRFIDCodeLength */ class ReadDoorLockMaxRFIDCodeLength : public ReadAttribute { public: ReadDoorLockMaxRFIDCodeLength() : ReadAttribute("max-rfidcode-length") { } ~ReadDoorLockMaxRFIDCodeLength() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::MaxRFIDCodeLength::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxRFIDCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.MaxRFIDCodeLength response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock MaxRFIDCodeLength read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockMaxRFIDCodeLength : public SubscribeAttribute { public: SubscribeAttributeDoorLockMaxRFIDCodeLength() : SubscribeAttribute("max-rfidcode-length") { } ~SubscribeAttributeDoorLockMaxRFIDCodeLength() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::MaxRFIDCodeLength::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxRFIDCodeLengthWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.MaxRFIDCodeLength response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinRFIDCodeLength */ class ReadDoorLockMinRFIDCodeLength : public ReadAttribute { public: ReadDoorLockMinRFIDCodeLength() : ReadAttribute("min-rfidcode-length") { } ~ReadDoorLockMinRFIDCodeLength() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::MinRFIDCodeLength::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinRFIDCodeLengthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.MinRFIDCodeLength response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock MinRFIDCodeLength read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockMinRFIDCodeLength : public SubscribeAttribute { public: SubscribeAttributeDoorLockMinRFIDCodeLength() : SubscribeAttribute("min-rfidcode-length") { } ~SubscribeAttributeDoorLockMinRFIDCodeLength() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::MinRFIDCodeLength::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinRFIDCodeLengthWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.MinRFIDCodeLength response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CredentialRulesSupport */ class ReadDoorLockCredentialRulesSupport : public ReadAttribute { public: ReadDoorLockCredentialRulesSupport() : ReadAttribute("credential-rules-support") { } ~ReadDoorLockCredentialRulesSupport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::CredentialRulesSupport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCredentialRulesSupportWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.CredentialRulesSupport response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock CredentialRulesSupport read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockCredentialRulesSupport : public SubscribeAttribute { public: SubscribeAttributeDoorLockCredentialRulesSupport() : SubscribeAttribute("credential-rules-support") { } ~SubscribeAttributeDoorLockCredentialRulesSupport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::CredentialRulesSupport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCredentialRulesSupportWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.CredentialRulesSupport response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NumberOfCredentialsSupportedPerUser */ class ReadDoorLockNumberOfCredentialsSupportedPerUser : public ReadAttribute { public: ReadDoorLockNumberOfCredentialsSupportedPerUser() : ReadAttribute("number-of-credentials-supported-per-user") { } ~ReadDoorLockNumberOfCredentialsSupportedPerUser() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfCredentialsSupportedPerUser::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfCredentialsSupportedPerUserWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfCredentialsSupportedPerUser response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock NumberOfCredentialsSupportedPerUser read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockNumberOfCredentialsSupportedPerUser : public SubscribeAttribute { public: SubscribeAttributeDoorLockNumberOfCredentialsSupportedPerUser() : SubscribeAttribute("number-of-credentials-supported-per-user") { } ~SubscribeAttributeDoorLockNumberOfCredentialsSupportedPerUser() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfCredentialsSupportedPerUser::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfCredentialsSupportedPerUserWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfCredentialsSupportedPerUser response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Language */ class ReadDoorLockLanguage : public ReadAttribute { public: ReadDoorLockLanguage() : ReadAttribute("language") { } ~ReadDoorLockLanguage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::Language::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLanguageWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.Language response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock Language read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockLanguage : public WriteAttribute { public: WriteDoorLockLanguage() : WriteAttribute("language") { AddArgument("attr-name", "language"); AddArgument("attr-value", &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockLanguage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::Language::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() length:mValue.size() encoding:NSUTF8StringEncoding]; [cluster writeAttributeLanguageWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock Language write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::ByteSpan mValue; }; class SubscribeAttributeDoorLockLanguage : public SubscribeAttribute { public: SubscribeAttributeDoorLockLanguage() : SubscribeAttribute("language") { } ~SubscribeAttributeDoorLockLanguage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::Language::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLanguageWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.Language response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LEDSettings */ class ReadDoorLockLEDSettings : public ReadAttribute { public: ReadDoorLockLEDSettings() : ReadAttribute("ledsettings") { } ~ReadDoorLockLEDSettings() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::LEDSettings::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLEDSettingsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.LEDSettings response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock LEDSettings read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockLEDSettings : public WriteAttribute { public: WriteDoorLockLEDSettings() : WriteAttribute("ledsettings") { AddArgument("attr-name", "ledsettings"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockLEDSettings() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::LEDSettings::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeLEDSettingsWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock LEDSettings write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeDoorLockLEDSettings : public SubscribeAttribute { public: SubscribeAttributeDoorLockLEDSettings() : SubscribeAttribute("ledsettings") { } ~SubscribeAttributeDoorLockLEDSettings() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::LEDSettings::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLEDSettingsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.LEDSettings response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AutoRelockTime */ class ReadDoorLockAutoRelockTime : public ReadAttribute { public: ReadDoorLockAutoRelockTime() : ReadAttribute("auto-relock-time") { } ~ReadDoorLockAutoRelockTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::AutoRelockTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAutoRelockTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AutoRelockTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock AutoRelockTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockAutoRelockTime : public WriteAttribute { public: WriteDoorLockAutoRelockTime() : WriteAttribute("auto-relock-time") { AddArgument("attr-name", "auto-relock-time"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockAutoRelockTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::AutoRelockTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; [cluster writeAttributeAutoRelockTimeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock AutoRelockTime write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint32_t mValue; }; class SubscribeAttributeDoorLockAutoRelockTime : public SubscribeAttribute { public: SubscribeAttributeDoorLockAutoRelockTime() : SubscribeAttribute("auto-relock-time") { } ~SubscribeAttributeDoorLockAutoRelockTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::AutoRelockTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAutoRelockTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AutoRelockTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SoundVolume */ class ReadDoorLockSoundVolume : public ReadAttribute { public: ReadDoorLockSoundVolume() : ReadAttribute("sound-volume") { } ~ReadDoorLockSoundVolume() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::SoundVolume::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSoundVolumeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.SoundVolume response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock SoundVolume read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockSoundVolume : public WriteAttribute { public: WriteDoorLockSoundVolume() : WriteAttribute("sound-volume") { AddArgument("attr-name", "sound-volume"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockSoundVolume() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::SoundVolume::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeSoundVolumeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock SoundVolume write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeDoorLockSoundVolume : public SubscribeAttribute { public: SubscribeAttributeDoorLockSoundVolume() : SubscribeAttribute("sound-volume") { } ~SubscribeAttributeDoorLockSoundVolume() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::SoundVolume::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSoundVolumeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.SoundVolume response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OperatingMode */ class ReadDoorLockOperatingMode : public ReadAttribute { public: ReadDoorLockOperatingMode() : ReadAttribute("operating-mode") { } ~ReadDoorLockOperatingMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::OperatingMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOperatingModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.OperatingMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock OperatingMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockOperatingMode : public WriteAttribute { public: WriteDoorLockOperatingMode() : WriteAttribute("operating-mode") { AddArgument("attr-name", "operating-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockOperatingMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::OperatingMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeOperatingModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock OperatingMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeDoorLockOperatingMode : public SubscribeAttribute { public: SubscribeAttributeDoorLockOperatingMode() : SubscribeAttribute("operating-mode") { } ~SubscribeAttributeDoorLockOperatingMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::OperatingMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOperatingModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.OperatingMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SupportedOperatingModes */ class ReadDoorLockSupportedOperatingModes : public ReadAttribute { public: ReadDoorLockSupportedOperatingModes() : ReadAttribute("supported-operating-modes") { } ~ReadDoorLockSupportedOperatingModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::SupportedOperatingModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedOperatingModesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.SupportedOperatingModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock SupportedOperatingModes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockSupportedOperatingModes : public SubscribeAttribute { public: SubscribeAttributeDoorLockSupportedOperatingModes() : SubscribeAttribute("supported-operating-modes") { } ~SubscribeAttributeDoorLockSupportedOperatingModes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::SupportedOperatingModes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedOperatingModesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.SupportedOperatingModes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute DefaultConfigurationRegister */ class ReadDoorLockDefaultConfigurationRegister : public ReadAttribute { public: ReadDoorLockDefaultConfigurationRegister() : ReadAttribute("default-configuration-register") { } ~ReadDoorLockDefaultConfigurationRegister() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::DefaultConfigurationRegister::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDefaultConfigurationRegisterWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.DefaultConfigurationRegister response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock DefaultConfigurationRegister read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockDefaultConfigurationRegister : public SubscribeAttribute { public: SubscribeAttributeDoorLockDefaultConfigurationRegister() : SubscribeAttribute("default-configuration-register") { } ~SubscribeAttributeDoorLockDefaultConfigurationRegister() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::DefaultConfigurationRegister::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDefaultConfigurationRegisterWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.DefaultConfigurationRegister response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute EnableLocalProgramming */ class ReadDoorLockEnableLocalProgramming : public ReadAttribute { public: ReadDoorLockEnableLocalProgramming() : ReadAttribute("enable-local-programming") { } ~ReadDoorLockEnableLocalProgramming() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::EnableLocalProgramming::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEnableLocalProgrammingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.EnableLocalProgramming response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock EnableLocalProgramming read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockEnableLocalProgramming : public WriteAttribute { public: WriteDoorLockEnableLocalProgramming() : WriteAttribute("enable-local-programming") { AddArgument("attr-name", "enable-local-programming"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockEnableLocalProgramming() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::EnableLocalProgramming::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeEnableLocalProgrammingWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock EnableLocalProgramming write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeDoorLockEnableLocalProgramming : public SubscribeAttribute { public: SubscribeAttributeDoorLockEnableLocalProgramming() : SubscribeAttribute("enable-local-programming") { } ~SubscribeAttributeDoorLockEnableLocalProgramming() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::EnableLocalProgramming::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEnableLocalProgrammingWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.EnableLocalProgramming response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute EnableOneTouchLocking */ class ReadDoorLockEnableOneTouchLocking : public ReadAttribute { public: ReadDoorLockEnableOneTouchLocking() : ReadAttribute("enable-one-touch-locking") { } ~ReadDoorLockEnableOneTouchLocking() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::EnableOneTouchLocking::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEnableOneTouchLockingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.EnableOneTouchLocking response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock EnableOneTouchLocking read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockEnableOneTouchLocking : public WriteAttribute { public: WriteDoorLockEnableOneTouchLocking() : WriteAttribute("enable-one-touch-locking") { AddArgument("attr-name", "enable-one-touch-locking"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockEnableOneTouchLocking() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::EnableOneTouchLocking::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeEnableOneTouchLockingWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock EnableOneTouchLocking write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeDoorLockEnableOneTouchLocking : public SubscribeAttribute { public: SubscribeAttributeDoorLockEnableOneTouchLocking() : SubscribeAttribute("enable-one-touch-locking") { } ~SubscribeAttributeDoorLockEnableOneTouchLocking() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::EnableOneTouchLocking::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEnableOneTouchLockingWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.EnableOneTouchLocking response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute EnableInsideStatusLED */ class ReadDoorLockEnableInsideStatusLED : public ReadAttribute { public: ReadDoorLockEnableInsideStatusLED() : ReadAttribute("enable-inside-status-led") { } ~ReadDoorLockEnableInsideStatusLED() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::EnableInsideStatusLED::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEnableInsideStatusLEDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.EnableInsideStatusLED response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock EnableInsideStatusLED read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockEnableInsideStatusLED : public WriteAttribute { public: WriteDoorLockEnableInsideStatusLED() : WriteAttribute("enable-inside-status-led") { AddArgument("attr-name", "enable-inside-status-led"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockEnableInsideStatusLED() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::EnableInsideStatusLED::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeEnableInsideStatusLEDWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock EnableInsideStatusLED write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeDoorLockEnableInsideStatusLED : public SubscribeAttribute { public: SubscribeAttributeDoorLockEnableInsideStatusLED() : SubscribeAttribute("enable-inside-status-led") { } ~SubscribeAttributeDoorLockEnableInsideStatusLED() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::EnableInsideStatusLED::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEnableInsideStatusLEDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.EnableInsideStatusLED response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute EnablePrivacyModeButton */ class ReadDoorLockEnablePrivacyModeButton : public ReadAttribute { public: ReadDoorLockEnablePrivacyModeButton() : ReadAttribute("enable-privacy-mode-button") { } ~ReadDoorLockEnablePrivacyModeButton() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::EnablePrivacyModeButton::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEnablePrivacyModeButtonWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.EnablePrivacyModeButton response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock EnablePrivacyModeButton read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockEnablePrivacyModeButton : public WriteAttribute { public: WriteDoorLockEnablePrivacyModeButton() : WriteAttribute("enable-privacy-mode-button") { AddArgument("attr-name", "enable-privacy-mode-button"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockEnablePrivacyModeButton() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::EnablePrivacyModeButton::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeEnablePrivacyModeButtonWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock EnablePrivacyModeButton write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeDoorLockEnablePrivacyModeButton : public SubscribeAttribute { public: SubscribeAttributeDoorLockEnablePrivacyModeButton() : SubscribeAttribute("enable-privacy-mode-button") { } ~SubscribeAttributeDoorLockEnablePrivacyModeButton() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::EnablePrivacyModeButton::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEnablePrivacyModeButtonWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.EnablePrivacyModeButton response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LocalProgrammingFeatures */ class ReadDoorLockLocalProgrammingFeatures : public ReadAttribute { public: ReadDoorLockLocalProgrammingFeatures() : ReadAttribute("local-programming-features") { } ~ReadDoorLockLocalProgrammingFeatures() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::LocalProgrammingFeatures::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLocalProgrammingFeaturesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.LocalProgrammingFeatures response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock LocalProgrammingFeatures read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockLocalProgrammingFeatures : public WriteAttribute { public: WriteDoorLockLocalProgrammingFeatures() : WriteAttribute("local-programming-features") { AddArgument("attr-name", "local-programming-features"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockLocalProgrammingFeatures() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::LocalProgrammingFeatures::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeLocalProgrammingFeaturesWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock LocalProgrammingFeatures write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeDoorLockLocalProgrammingFeatures : public SubscribeAttribute { public: SubscribeAttributeDoorLockLocalProgrammingFeatures() : SubscribeAttribute("local-programming-features") { } ~SubscribeAttributeDoorLockLocalProgrammingFeatures() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::LocalProgrammingFeatures::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLocalProgrammingFeaturesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.LocalProgrammingFeatures response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute WrongCodeEntryLimit */ class ReadDoorLockWrongCodeEntryLimit : public ReadAttribute { public: ReadDoorLockWrongCodeEntryLimit() : ReadAttribute("wrong-code-entry-limit") { } ~ReadDoorLockWrongCodeEntryLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::WrongCodeEntryLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWrongCodeEntryLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.WrongCodeEntryLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock WrongCodeEntryLimit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockWrongCodeEntryLimit : public WriteAttribute { public: WriteDoorLockWrongCodeEntryLimit() : WriteAttribute("wrong-code-entry-limit") { AddArgument("attr-name", "wrong-code-entry-limit"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockWrongCodeEntryLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::WrongCodeEntryLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeWrongCodeEntryLimitWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock WrongCodeEntryLimit write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeDoorLockWrongCodeEntryLimit : public SubscribeAttribute { public: SubscribeAttributeDoorLockWrongCodeEntryLimit() : SubscribeAttribute("wrong-code-entry-limit") { } ~SubscribeAttributeDoorLockWrongCodeEntryLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::WrongCodeEntryLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWrongCodeEntryLimitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.WrongCodeEntryLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute UserCodeTemporaryDisableTime */ class ReadDoorLockUserCodeTemporaryDisableTime : public ReadAttribute { public: ReadDoorLockUserCodeTemporaryDisableTime() : ReadAttribute("user-code-temporary-disable-time") { } ~ReadDoorLockUserCodeTemporaryDisableTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::UserCodeTemporaryDisableTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUserCodeTemporaryDisableTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.UserCodeTemporaryDisableTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock UserCodeTemporaryDisableTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockUserCodeTemporaryDisableTime : public WriteAttribute { public: WriteDoorLockUserCodeTemporaryDisableTime() : WriteAttribute("user-code-temporary-disable-time") { AddArgument("attr-name", "user-code-temporary-disable-time"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockUserCodeTemporaryDisableTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::UserCodeTemporaryDisableTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeUserCodeTemporaryDisableTimeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock UserCodeTemporaryDisableTime write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeDoorLockUserCodeTemporaryDisableTime : public SubscribeAttribute { public: SubscribeAttributeDoorLockUserCodeTemporaryDisableTime() : SubscribeAttribute("user-code-temporary-disable-time") { } ~SubscribeAttributeDoorLockUserCodeTemporaryDisableTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::UserCodeTemporaryDisableTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUserCodeTemporaryDisableTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.UserCodeTemporaryDisableTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SendPINOverTheAir */ class ReadDoorLockSendPINOverTheAir : public ReadAttribute { public: ReadDoorLockSendPINOverTheAir() : ReadAttribute("send-pinover-the-air") { } ~ReadDoorLockSendPINOverTheAir() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::SendPINOverTheAir::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSendPINOverTheAirWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.SendPINOverTheAir response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock SendPINOverTheAir read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockSendPINOverTheAir : public WriteAttribute { public: WriteDoorLockSendPINOverTheAir() : WriteAttribute("send-pinover-the-air") { AddArgument("attr-name", "send-pinover-the-air"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockSendPINOverTheAir() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::SendPINOverTheAir::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeSendPINOverTheAirWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock SendPINOverTheAir write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeDoorLockSendPINOverTheAir : public SubscribeAttribute { public: SubscribeAttributeDoorLockSendPINOverTheAir() : SubscribeAttribute("send-pinover-the-air") { } ~SubscribeAttributeDoorLockSendPINOverTheAir() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::SendPINOverTheAir::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSendPINOverTheAirWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.SendPINOverTheAir response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RequirePINforRemoteOperation */ class ReadDoorLockRequirePINforRemoteOperation : public ReadAttribute { public: ReadDoorLockRequirePINforRemoteOperation() : ReadAttribute("require-pinfor-remote-operation") { } ~ReadDoorLockRequirePINforRemoteOperation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::RequirePINforRemoteOperation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRequirePINforRemoteOperationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.RequirePINforRemoteOperation response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock RequirePINforRemoteOperation read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockRequirePINforRemoteOperation : public WriteAttribute { public: WriteDoorLockRequirePINforRemoteOperation() : WriteAttribute("require-pinfor-remote-operation") { AddArgument("attr-name", "require-pinfor-remote-operation"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockRequirePINforRemoteOperation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::RequirePINforRemoteOperation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeRequirePINforRemoteOperationWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock RequirePINforRemoteOperation write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeDoorLockRequirePINforRemoteOperation : public SubscribeAttribute { public: SubscribeAttributeDoorLockRequirePINforRemoteOperation() : SubscribeAttribute("require-pinfor-remote-operation") { } ~SubscribeAttributeDoorLockRequirePINforRemoteOperation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::RequirePINforRemoteOperation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRequirePINforRemoteOperationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.RequirePINforRemoteOperation response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ExpiringUserTimeout */ class ReadDoorLockExpiringUserTimeout : public ReadAttribute { public: ReadDoorLockExpiringUserTimeout() : ReadAttribute("expiring-user-timeout") { } ~ReadDoorLockExpiringUserTimeout() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::ExpiringUserTimeout::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeExpiringUserTimeoutWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.ExpiringUserTimeout response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock ExpiringUserTimeout read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteDoorLockExpiringUserTimeout : public WriteAttribute { public: WriteDoorLockExpiringUserTimeout() : WriteAttribute("expiring-user-timeout") { AddArgument("attr-name", "expiring-user-timeout"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteDoorLockExpiringUserTimeout() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::ExpiringUserTimeout::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeExpiringUserTimeoutWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("DoorLock ExpiringUserTimeout write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeDoorLockExpiringUserTimeout : public SubscribeAttribute { public: SubscribeAttributeDoorLockExpiringUserTimeout() : SubscribeAttribute("expiring-user-timeout") { } ~SubscribeAttributeDoorLockExpiringUserTimeout() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::ExpiringUserTimeout::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeExpiringUserTimeoutWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.ExpiringUserTimeout response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute AliroReaderVerificationKey */ class ReadDoorLockAliroReaderVerificationKey : public ReadAttribute { public: ReadDoorLockAliroReaderVerificationKey() : ReadAttribute("aliro-reader-verification-key") { } ~ReadDoorLockAliroReaderVerificationKey() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::AliroReaderVerificationKey::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAliroReaderVerificationKeyWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AliroReaderVerificationKey response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock AliroReaderVerificationKey read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockAliroReaderVerificationKey : public SubscribeAttribute { public: SubscribeAttributeDoorLockAliroReaderVerificationKey() : SubscribeAttribute("aliro-reader-verification-key") { } ~SubscribeAttributeDoorLockAliroReaderVerificationKey() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::AliroReaderVerificationKey::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAliroReaderVerificationKeyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AliroReaderVerificationKey response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AliroReaderGroupIdentifier */ class ReadDoorLockAliroReaderGroupIdentifier : public ReadAttribute { public: ReadDoorLockAliroReaderGroupIdentifier() : ReadAttribute("aliro-reader-group-identifier") { } ~ReadDoorLockAliroReaderGroupIdentifier() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::AliroReaderGroupIdentifier::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAliroReaderGroupIdentifierWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AliroReaderGroupIdentifier response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock AliroReaderGroupIdentifier read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockAliroReaderGroupIdentifier : public SubscribeAttribute { public: SubscribeAttributeDoorLockAliroReaderGroupIdentifier() : SubscribeAttribute("aliro-reader-group-identifier") { } ~SubscribeAttributeDoorLockAliroReaderGroupIdentifier() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::AliroReaderGroupIdentifier::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAliroReaderGroupIdentifierWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AliroReaderGroupIdentifier response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AliroReaderGroupSubIdentifier */ class ReadDoorLockAliroReaderGroupSubIdentifier : public ReadAttribute { public: ReadDoorLockAliroReaderGroupSubIdentifier() : ReadAttribute("aliro-reader-group-sub-identifier") { } ~ReadDoorLockAliroReaderGroupSubIdentifier() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::AliroReaderGroupSubIdentifier::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAliroReaderGroupSubIdentifierWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AliroReaderGroupSubIdentifier response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock AliroReaderGroupSubIdentifier read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockAliroReaderGroupSubIdentifier : public SubscribeAttribute { public: SubscribeAttributeDoorLockAliroReaderGroupSubIdentifier() : SubscribeAttribute("aliro-reader-group-sub-identifier") { } ~SubscribeAttributeDoorLockAliroReaderGroupSubIdentifier() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::AliroReaderGroupSubIdentifier::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAliroReaderGroupSubIdentifierWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AliroReaderGroupSubIdentifier response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AliroExpeditedTransactionSupportedProtocolVersions */ class ReadDoorLockAliroExpeditedTransactionSupportedProtocolVersions : public ReadAttribute { public: ReadDoorLockAliroExpeditedTransactionSupportedProtocolVersions() : ReadAttribute("aliro-expedited-transaction-supported-protocol-versions") { } ~ReadDoorLockAliroExpeditedTransactionSupportedProtocolVersions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::AliroExpeditedTransactionSupportedProtocolVersions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAliroExpeditedTransactionSupportedProtocolVersionsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AliroExpeditedTransactionSupportedProtocolVersions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock AliroExpeditedTransactionSupportedProtocolVersions read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockAliroExpeditedTransactionSupportedProtocolVersions : public SubscribeAttribute { public: SubscribeAttributeDoorLockAliroExpeditedTransactionSupportedProtocolVersions() : SubscribeAttribute("aliro-expedited-transaction-supported-protocol-versions") { } ~SubscribeAttributeDoorLockAliroExpeditedTransactionSupportedProtocolVersions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::AliroExpeditedTransactionSupportedProtocolVersions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAliroExpeditedTransactionSupportedProtocolVersionsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AliroExpeditedTransactionSupportedProtocolVersions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AliroGroupResolvingKey */ class ReadDoorLockAliroGroupResolvingKey : public ReadAttribute { public: ReadDoorLockAliroGroupResolvingKey() : ReadAttribute("aliro-group-resolving-key") { } ~ReadDoorLockAliroGroupResolvingKey() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::AliroGroupResolvingKey::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAliroGroupResolvingKeyWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AliroGroupResolvingKey response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock AliroGroupResolvingKey read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockAliroGroupResolvingKey : public SubscribeAttribute { public: SubscribeAttributeDoorLockAliroGroupResolvingKey() : SubscribeAttribute("aliro-group-resolving-key") { } ~SubscribeAttributeDoorLockAliroGroupResolvingKey() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::AliroGroupResolvingKey::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAliroGroupResolvingKeyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AliroGroupResolvingKey response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AliroSupportedBLEUWBProtocolVersions */ class ReadDoorLockAliroSupportedBLEUWBProtocolVersions : public ReadAttribute { public: ReadDoorLockAliroSupportedBLEUWBProtocolVersions() : ReadAttribute("aliro-supported-bleuwbprotocol-versions") { } ~ReadDoorLockAliroSupportedBLEUWBProtocolVersions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::AliroSupportedBLEUWBProtocolVersions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAliroSupportedBLEUWBProtocolVersionsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AliroSupportedBLEUWBProtocolVersions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock AliroSupportedBLEUWBProtocolVersions read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockAliroSupportedBLEUWBProtocolVersions : public SubscribeAttribute { public: SubscribeAttributeDoorLockAliroSupportedBLEUWBProtocolVersions() : SubscribeAttribute("aliro-supported-bleuwbprotocol-versions") { } ~SubscribeAttributeDoorLockAliroSupportedBLEUWBProtocolVersions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::AliroSupportedBLEUWBProtocolVersions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAliroSupportedBLEUWBProtocolVersionsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AliroSupportedBLEUWBProtocolVersions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AliroBLEAdvertisingVersion */ class ReadDoorLockAliroBLEAdvertisingVersion : public ReadAttribute { public: ReadDoorLockAliroBLEAdvertisingVersion() : ReadAttribute("aliro-bleadvertising-version") { } ~ReadDoorLockAliroBLEAdvertisingVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::AliroBLEAdvertisingVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAliroBLEAdvertisingVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AliroBLEAdvertisingVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock AliroBLEAdvertisingVersion read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockAliroBLEAdvertisingVersion : public SubscribeAttribute { public: SubscribeAttributeDoorLockAliroBLEAdvertisingVersion() : SubscribeAttribute("aliro-bleadvertising-version") { } ~SubscribeAttributeDoorLockAliroBLEAdvertisingVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::AliroBLEAdvertisingVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAliroBLEAdvertisingVersionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AliroBLEAdvertisingVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NumberOfAliroCredentialIssuerKeysSupported */ class ReadDoorLockNumberOfAliroCredentialIssuerKeysSupported : public ReadAttribute { public: ReadDoorLockNumberOfAliroCredentialIssuerKeysSupported() : ReadAttribute("number-of-aliro-credential-issuer-keys-supported") { } ~ReadDoorLockNumberOfAliroCredentialIssuerKeysSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfAliroCredentialIssuerKeysSupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfAliroCredentialIssuerKeysSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfAliroCredentialIssuerKeysSupported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock NumberOfAliroCredentialIssuerKeysSupported read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockNumberOfAliroCredentialIssuerKeysSupported : public SubscribeAttribute { public: SubscribeAttributeDoorLockNumberOfAliroCredentialIssuerKeysSupported() : SubscribeAttribute("number-of-aliro-credential-issuer-keys-supported") { } ~SubscribeAttributeDoorLockNumberOfAliroCredentialIssuerKeysSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfAliroCredentialIssuerKeysSupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfAliroCredentialIssuerKeysSupportedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfAliroCredentialIssuerKeysSupported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NumberOfAliroEndpointKeysSupported */ class ReadDoorLockNumberOfAliroEndpointKeysSupported : public ReadAttribute { public: ReadDoorLockNumberOfAliroEndpointKeysSupported() : ReadAttribute("number-of-aliro-endpoint-keys-supported") { } ~ReadDoorLockNumberOfAliroEndpointKeysSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfAliroEndpointKeysSupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfAliroEndpointKeysSupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfAliroEndpointKeysSupported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock NumberOfAliroEndpointKeysSupported read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockNumberOfAliroEndpointKeysSupported : public SubscribeAttribute { public: SubscribeAttributeDoorLockNumberOfAliroEndpointKeysSupported() : SubscribeAttribute("number-of-aliro-endpoint-keys-supported") { } ~SubscribeAttributeDoorLockNumberOfAliroEndpointKeysSupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::NumberOfAliroEndpointKeysSupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfAliroEndpointKeysSupportedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfAliroEndpointKeysSupported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadDoorLockGeneratedCommandList : public ReadAttribute { public: ReadDoorLockGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadDoorLockGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeDoorLockGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeDoorLockGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadDoorLockAcceptedCommandList : public ReadAttribute { public: ReadDoorLockAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadDoorLockAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeDoorLockAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeDoorLockAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadDoorLockEventList : public ReadAttribute { public: ReadDoorLockEventList() : ReadAttribute("event-list") { } ~ReadDoorLockEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockEventList : public SubscribeAttribute { public: SubscribeAttributeDoorLockEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeDoorLockEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadDoorLockAttributeList : public ReadAttribute { public: ReadDoorLockAttributeList() : ReadAttribute("attribute-list") { } ~ReadDoorLockAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockAttributeList : public SubscribeAttribute { public: SubscribeAttributeDoorLockAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeDoorLockAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadDoorLockFeatureMap : public ReadAttribute { public: ReadDoorLockFeatureMap() : ReadAttribute("feature-map") { } ~ReadDoorLockFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockFeatureMap : public SubscribeAttribute { public: SubscribeAttributeDoorLockFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeDoorLockFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadDoorLockClusterRevision : public ReadAttribute { public: ReadDoorLockClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadDoorLockClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::DoorLock::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("DoorLock ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeDoorLockClusterRevision : public SubscribeAttribute { public: SubscribeAttributeDoorLockClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeDoorLockClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::DoorLock::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::DoorLock::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster WindowCovering | 0x0102 | |------------------------------------------------------------------------------| | Commands: | | | * UpOrOpen | 0x00 | | * DownOrClose | 0x01 | | * StopMotion | 0x02 | | * GoToLiftValue | 0x04 | | * GoToLiftPercentage | 0x05 | | * GoToTiltValue | 0x07 | | * GoToTiltPercentage | 0x08 | |------------------------------------------------------------------------------| | Attributes: | | | * Type | 0x0000 | | * PhysicalClosedLimitLift | 0x0001 | | * PhysicalClosedLimitTilt | 0x0002 | | * CurrentPositionLift | 0x0003 | | * CurrentPositionTilt | 0x0004 | | * NumberOfActuationsLift | 0x0005 | | * NumberOfActuationsTilt | 0x0006 | | * ConfigStatus | 0x0007 | | * CurrentPositionLiftPercentage | 0x0008 | | * CurrentPositionTiltPercentage | 0x0009 | | * OperationalStatus | 0x000A | | * TargetPositionLiftPercent100ths | 0x000B | | * TargetPositionTiltPercent100ths | 0x000C | | * EndProductType | 0x000D | | * CurrentPositionLiftPercent100ths | 0x000E | | * CurrentPositionTiltPercent100ths | 0x000F | | * InstalledOpenLimitLift | 0x0010 | | * InstalledClosedLimitLift | 0x0011 | | * InstalledOpenLimitTilt | 0x0012 | | * InstalledClosedLimitTilt | 0x0013 | | * Mode | 0x0017 | | * SafetyStatus | 0x001A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command UpOrOpen */ class WindowCoveringUpOrOpen : public ClusterCommand { public: WindowCoveringUpOrOpen() : ClusterCommand("up-or-open") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WindowCovering::Commands::UpOrOpen::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWindowCoveringClusterUpOrOpenParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster upOrOpenWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command DownOrClose */ class WindowCoveringDownOrClose : public ClusterCommand { public: WindowCoveringDownOrClose() : ClusterCommand("down-or-close") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WindowCovering::Commands::DownOrClose::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWindowCoveringClusterDownOrCloseParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster downOrCloseWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command StopMotion */ class WindowCoveringStopMotion : public ClusterCommand { public: WindowCoveringStopMotion() : ClusterCommand("stop-motion") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WindowCovering::Commands::StopMotion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWindowCoveringClusterStopMotionParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stopMotionWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command GoToLiftValue */ class WindowCoveringGoToLiftValue : public ClusterCommand { public: WindowCoveringGoToLiftValue() : ClusterCommand("go-to-lift-value") { AddArgument("LiftValue", 0, UINT16_MAX, &mRequest.liftValue); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WindowCovering::Commands::GoToLiftValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWindowCoveringClusterGoToLiftValueParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.liftValue = [NSNumber numberWithUnsignedShort:mRequest.liftValue]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster goToLiftValueWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::WindowCovering::Commands::GoToLiftValue::Type mRequest; }; /* * Command GoToLiftPercentage */ class WindowCoveringGoToLiftPercentage : public ClusterCommand { public: WindowCoveringGoToLiftPercentage() : ClusterCommand("go-to-lift-percentage") { AddArgument("LiftPercent100thsValue", 0, UINT16_MAX, &mRequest.liftPercent100thsValue); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWindowCoveringClusterGoToLiftPercentageParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.liftPercent100thsValue = [NSNumber numberWithUnsignedShort:mRequest.liftPercent100thsValue]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster goToLiftPercentageWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::WindowCovering::Commands::GoToLiftPercentage::Type mRequest; }; /* * Command GoToTiltValue */ class WindowCoveringGoToTiltValue : public ClusterCommand { public: WindowCoveringGoToTiltValue() : ClusterCommand("go-to-tilt-value") { AddArgument("TiltValue", 0, UINT16_MAX, &mRequest.tiltValue); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WindowCovering::Commands::GoToTiltValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWindowCoveringClusterGoToTiltValueParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.tiltValue = [NSNumber numberWithUnsignedShort:mRequest.tiltValue]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster goToTiltValueWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::WindowCovering::Commands::GoToTiltValue::Type mRequest; }; /* * Command GoToTiltPercentage */ class WindowCoveringGoToTiltPercentage : public ClusterCommand { public: WindowCoveringGoToTiltPercentage() : ClusterCommand("go-to-tilt-percentage") { AddArgument("TiltPercent100thsValue", 0, UINT16_MAX, &mRequest.tiltPercent100thsValue); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWindowCoveringClusterGoToTiltPercentageParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.tiltPercent100thsValue = [NSNumber numberWithUnsignedShort:mRequest.tiltPercent100thsValue]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster goToTiltPercentageWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::WindowCovering::Commands::GoToTiltPercentage::Type mRequest; }; /* * Attribute Type */ class ReadWindowCoveringType : public ReadAttribute { public: ReadWindowCoveringType() : ReadAttribute("type") { } ~ReadWindowCoveringType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::Type::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.Type response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering Type read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringType : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringType() : SubscribeAttribute("type") { } ~SubscribeAttributeWindowCoveringType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::Type::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTypeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.Type response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PhysicalClosedLimitLift */ class ReadWindowCoveringPhysicalClosedLimitLift : public ReadAttribute { public: ReadWindowCoveringPhysicalClosedLimitLift() : ReadAttribute("physical-closed-limit-lift") { } ~ReadWindowCoveringPhysicalClosedLimitLift() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::PhysicalClosedLimitLift::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePhysicalClosedLimitLiftWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.PhysicalClosedLimitLift response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering PhysicalClosedLimitLift read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringPhysicalClosedLimitLift : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringPhysicalClosedLimitLift() : SubscribeAttribute("physical-closed-limit-lift") { } ~SubscribeAttributeWindowCoveringPhysicalClosedLimitLift() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::PhysicalClosedLimitLift::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePhysicalClosedLimitLiftWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.PhysicalClosedLimitLift response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PhysicalClosedLimitTilt */ class ReadWindowCoveringPhysicalClosedLimitTilt : public ReadAttribute { public: ReadWindowCoveringPhysicalClosedLimitTilt() : ReadAttribute("physical-closed-limit-tilt") { } ~ReadWindowCoveringPhysicalClosedLimitTilt() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::PhysicalClosedLimitTilt::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePhysicalClosedLimitTiltWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.PhysicalClosedLimitTilt response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering PhysicalClosedLimitTilt read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringPhysicalClosedLimitTilt : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringPhysicalClosedLimitTilt() : SubscribeAttribute("physical-closed-limit-tilt") { } ~SubscribeAttributeWindowCoveringPhysicalClosedLimitTilt() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::PhysicalClosedLimitTilt::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePhysicalClosedLimitTiltWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.PhysicalClosedLimitTilt response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentPositionLift */ class ReadWindowCoveringCurrentPositionLift : public ReadAttribute { public: ReadWindowCoveringCurrentPositionLift() : ReadAttribute("current-position-lift") { } ~ReadWindowCoveringCurrentPositionLift() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionLift::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentPositionLiftWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.CurrentPositionLift response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering CurrentPositionLift read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringCurrentPositionLift : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringCurrentPositionLift() : SubscribeAttribute("current-position-lift") { } ~SubscribeAttributeWindowCoveringCurrentPositionLift() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionLift::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentPositionLiftWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.CurrentPositionLift response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentPositionTilt */ class ReadWindowCoveringCurrentPositionTilt : public ReadAttribute { public: ReadWindowCoveringCurrentPositionTilt() : ReadAttribute("current-position-tilt") { } ~ReadWindowCoveringCurrentPositionTilt() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionTilt::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentPositionTiltWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.CurrentPositionTilt response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering CurrentPositionTilt read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringCurrentPositionTilt : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringCurrentPositionTilt() : SubscribeAttribute("current-position-tilt") { } ~SubscribeAttributeWindowCoveringCurrentPositionTilt() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionTilt::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentPositionTiltWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.CurrentPositionTilt response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NumberOfActuationsLift */ class ReadWindowCoveringNumberOfActuationsLift : public ReadAttribute { public: ReadWindowCoveringNumberOfActuationsLift() : ReadAttribute("number-of-actuations-lift") { } ~ReadWindowCoveringNumberOfActuationsLift() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::NumberOfActuationsLift::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfActuationsLiftWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.NumberOfActuationsLift response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering NumberOfActuationsLift read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringNumberOfActuationsLift : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringNumberOfActuationsLift() : SubscribeAttribute("number-of-actuations-lift") { } ~SubscribeAttributeWindowCoveringNumberOfActuationsLift() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::NumberOfActuationsLift::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfActuationsLiftWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.NumberOfActuationsLift response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NumberOfActuationsTilt */ class ReadWindowCoveringNumberOfActuationsTilt : public ReadAttribute { public: ReadWindowCoveringNumberOfActuationsTilt() : ReadAttribute("number-of-actuations-tilt") { } ~ReadWindowCoveringNumberOfActuationsTilt() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::NumberOfActuationsTilt::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfActuationsTiltWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.NumberOfActuationsTilt response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering NumberOfActuationsTilt read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringNumberOfActuationsTilt : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringNumberOfActuationsTilt() : SubscribeAttribute("number-of-actuations-tilt") { } ~SubscribeAttributeWindowCoveringNumberOfActuationsTilt() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::NumberOfActuationsTilt::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfActuationsTiltWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.NumberOfActuationsTilt response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ConfigStatus */ class ReadWindowCoveringConfigStatus : public ReadAttribute { public: ReadWindowCoveringConfigStatus() : ReadAttribute("config-status") { } ~ReadWindowCoveringConfigStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::ConfigStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeConfigStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.ConfigStatus response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering ConfigStatus read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringConfigStatus : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringConfigStatus() : SubscribeAttribute("config-status") { } ~SubscribeAttributeWindowCoveringConfigStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::ConfigStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeConfigStatusWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.ConfigStatus response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentPositionLiftPercentage */ class ReadWindowCoveringCurrentPositionLiftPercentage : public ReadAttribute { public: ReadWindowCoveringCurrentPositionLiftPercentage() : ReadAttribute("current-position-lift-percentage") { } ~ReadWindowCoveringCurrentPositionLiftPercentage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionLiftPercentage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentPositionLiftPercentageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.CurrentPositionLiftPercentage response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering CurrentPositionLiftPercentage read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringCurrentPositionLiftPercentage : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringCurrentPositionLiftPercentage() : SubscribeAttribute("current-position-lift-percentage") { } ~SubscribeAttributeWindowCoveringCurrentPositionLiftPercentage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionLiftPercentage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentPositionLiftPercentageWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.CurrentPositionLiftPercentage response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentPositionTiltPercentage */ class ReadWindowCoveringCurrentPositionTiltPercentage : public ReadAttribute { public: ReadWindowCoveringCurrentPositionTiltPercentage() : ReadAttribute("current-position-tilt-percentage") { } ~ReadWindowCoveringCurrentPositionTiltPercentage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionTiltPercentage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentPositionTiltPercentageWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.CurrentPositionTiltPercentage response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering CurrentPositionTiltPercentage read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringCurrentPositionTiltPercentage : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringCurrentPositionTiltPercentage() : SubscribeAttribute("current-position-tilt-percentage") { } ~SubscribeAttributeWindowCoveringCurrentPositionTiltPercentage() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionTiltPercentage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentPositionTiltPercentageWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.CurrentPositionTiltPercentage response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OperationalStatus */ class ReadWindowCoveringOperationalStatus : public ReadAttribute { public: ReadWindowCoveringOperationalStatus() : ReadAttribute("operational-status") { } ~ReadWindowCoveringOperationalStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::OperationalStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOperationalStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.OperationalStatus response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering OperationalStatus read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringOperationalStatus : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringOperationalStatus() : SubscribeAttribute("operational-status") { } ~SubscribeAttributeWindowCoveringOperationalStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::OperationalStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOperationalStatusWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.OperationalStatus response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TargetPositionLiftPercent100ths */ class ReadWindowCoveringTargetPositionLiftPercent100ths : public ReadAttribute { public: ReadWindowCoveringTargetPositionLiftPercent100ths() : ReadAttribute("target-position-lift-percent100ths") { } ~ReadWindowCoveringTargetPositionLiftPercent100ths() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTargetPositionLiftPercent100thsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.TargetPositionLiftPercent100ths response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering TargetPositionLiftPercent100ths read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringTargetPositionLiftPercent100ths : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringTargetPositionLiftPercent100ths() : SubscribeAttribute("target-position-lift-percent100ths") { } ~SubscribeAttributeWindowCoveringTargetPositionLiftPercent100ths() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::TargetPositionLiftPercent100ths::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTargetPositionLiftPercent100thsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.TargetPositionLiftPercent100ths response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TargetPositionTiltPercent100ths */ class ReadWindowCoveringTargetPositionTiltPercent100ths : public ReadAttribute { public: ReadWindowCoveringTargetPositionTiltPercent100ths() : ReadAttribute("target-position-tilt-percent100ths") { } ~ReadWindowCoveringTargetPositionTiltPercent100ths() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTargetPositionTiltPercent100thsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.TargetPositionTiltPercent100ths response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering TargetPositionTiltPercent100ths read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringTargetPositionTiltPercent100ths : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringTargetPositionTiltPercent100ths() : SubscribeAttribute("target-position-tilt-percent100ths") { } ~SubscribeAttributeWindowCoveringTargetPositionTiltPercent100ths() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::TargetPositionTiltPercent100ths::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTargetPositionTiltPercent100thsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.TargetPositionTiltPercent100ths response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute EndProductType */ class ReadWindowCoveringEndProductType : public ReadAttribute { public: ReadWindowCoveringEndProductType() : ReadAttribute("end-product-type") { } ~ReadWindowCoveringEndProductType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::EndProductType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEndProductTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.EndProductType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering EndProductType read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringEndProductType : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringEndProductType() : SubscribeAttribute("end-product-type") { } ~SubscribeAttributeWindowCoveringEndProductType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::EndProductType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEndProductTypeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.EndProductType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentPositionLiftPercent100ths */ class ReadWindowCoveringCurrentPositionLiftPercent100ths : public ReadAttribute { public: ReadWindowCoveringCurrentPositionLiftPercent100ths() : ReadAttribute("current-position-lift-percent100ths") { } ~ReadWindowCoveringCurrentPositionLiftPercent100ths() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentPositionLiftPercent100thsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.CurrentPositionLiftPercent100ths response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering CurrentPositionLiftPercent100ths read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringCurrentPositionLiftPercent100ths : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringCurrentPositionLiftPercent100ths() : SubscribeAttribute("current-position-lift-percent100ths") { } ~SubscribeAttributeWindowCoveringCurrentPositionLiftPercent100ths() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionLiftPercent100ths::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentPositionLiftPercent100thsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.CurrentPositionLiftPercent100ths response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentPositionTiltPercent100ths */ class ReadWindowCoveringCurrentPositionTiltPercent100ths : public ReadAttribute { public: ReadWindowCoveringCurrentPositionTiltPercent100ths() : ReadAttribute("current-position-tilt-percent100ths") { } ~ReadWindowCoveringCurrentPositionTiltPercent100ths() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentPositionTiltPercent100thsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.CurrentPositionTiltPercent100ths response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering CurrentPositionTiltPercent100ths read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringCurrentPositionTiltPercent100ths : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringCurrentPositionTiltPercent100ths() : SubscribeAttribute("current-position-tilt-percent100ths") { } ~SubscribeAttributeWindowCoveringCurrentPositionTiltPercent100ths() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::CurrentPositionTiltPercent100ths::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentPositionTiltPercent100thsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.CurrentPositionTiltPercent100ths response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute InstalledOpenLimitLift */ class ReadWindowCoveringInstalledOpenLimitLift : public ReadAttribute { public: ReadWindowCoveringInstalledOpenLimitLift() : ReadAttribute("installed-open-limit-lift") { } ~ReadWindowCoveringInstalledOpenLimitLift() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::InstalledOpenLimitLift::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInstalledOpenLimitLiftWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.InstalledOpenLimitLift response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering InstalledOpenLimitLift read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringInstalledOpenLimitLift : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringInstalledOpenLimitLift() : SubscribeAttribute("installed-open-limit-lift") { } ~SubscribeAttributeWindowCoveringInstalledOpenLimitLift() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::InstalledOpenLimitLift::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInstalledOpenLimitLiftWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.InstalledOpenLimitLift response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute InstalledClosedLimitLift */ class ReadWindowCoveringInstalledClosedLimitLift : public ReadAttribute { public: ReadWindowCoveringInstalledClosedLimitLift() : ReadAttribute("installed-closed-limit-lift") { } ~ReadWindowCoveringInstalledClosedLimitLift() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::InstalledClosedLimitLift::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInstalledClosedLimitLiftWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.InstalledClosedLimitLift response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering InstalledClosedLimitLift read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringInstalledClosedLimitLift : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringInstalledClosedLimitLift() : SubscribeAttribute("installed-closed-limit-lift") { } ~SubscribeAttributeWindowCoveringInstalledClosedLimitLift() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::InstalledClosedLimitLift::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInstalledClosedLimitLiftWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.InstalledClosedLimitLift response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute InstalledOpenLimitTilt */ class ReadWindowCoveringInstalledOpenLimitTilt : public ReadAttribute { public: ReadWindowCoveringInstalledOpenLimitTilt() : ReadAttribute("installed-open-limit-tilt") { } ~ReadWindowCoveringInstalledOpenLimitTilt() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::InstalledOpenLimitTilt::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInstalledOpenLimitTiltWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.InstalledOpenLimitTilt response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering InstalledOpenLimitTilt read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringInstalledOpenLimitTilt : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringInstalledOpenLimitTilt() : SubscribeAttribute("installed-open-limit-tilt") { } ~SubscribeAttributeWindowCoveringInstalledOpenLimitTilt() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::InstalledOpenLimitTilt::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInstalledOpenLimitTiltWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.InstalledOpenLimitTilt response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute InstalledClosedLimitTilt */ class ReadWindowCoveringInstalledClosedLimitTilt : public ReadAttribute { public: ReadWindowCoveringInstalledClosedLimitTilt() : ReadAttribute("installed-closed-limit-tilt") { } ~ReadWindowCoveringInstalledClosedLimitTilt() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::InstalledClosedLimitTilt::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInstalledClosedLimitTiltWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.InstalledClosedLimitTilt response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering InstalledClosedLimitTilt read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringInstalledClosedLimitTilt : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringInstalledClosedLimitTilt() : SubscribeAttribute("installed-closed-limit-tilt") { } ~SubscribeAttributeWindowCoveringInstalledClosedLimitTilt() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::InstalledClosedLimitTilt::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInstalledClosedLimitTiltWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.InstalledClosedLimitTilt response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Mode */ class ReadWindowCoveringMode : public ReadAttribute { public: ReadWindowCoveringMode() : ReadAttribute("mode") { } ~ReadWindowCoveringMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::Mode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.Mode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering Mode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteWindowCoveringMode : public WriteAttribute { public: WriteWindowCoveringMode() : WriteAttribute("mode") { AddArgument("attr-name", "mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteWindowCoveringMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::Mode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("WindowCovering Mode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeWindowCoveringMode : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringMode() : SubscribeAttribute("mode") { } ~SubscribeAttributeWindowCoveringMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::Mode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.Mode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SafetyStatus */ class ReadWindowCoveringSafetyStatus : public ReadAttribute { public: ReadWindowCoveringSafetyStatus() : ReadAttribute("safety-status") { } ~ReadWindowCoveringSafetyStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::SafetyStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSafetyStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.SafetyStatus response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering SafetyStatus read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringSafetyStatus : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringSafetyStatus() : SubscribeAttribute("safety-status") { } ~SubscribeAttributeWindowCoveringSafetyStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::SafetyStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSafetyStatusWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.SafetyStatus response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadWindowCoveringGeneratedCommandList : public ReadAttribute { public: ReadWindowCoveringGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadWindowCoveringGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeWindowCoveringGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadWindowCoveringAcceptedCommandList : public ReadAttribute { public: ReadWindowCoveringAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadWindowCoveringAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeWindowCoveringAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadWindowCoveringEventList : public ReadAttribute { public: ReadWindowCoveringEventList() : ReadAttribute("event-list") { } ~ReadWindowCoveringEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringEventList : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeWindowCoveringEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadWindowCoveringAttributeList : public ReadAttribute { public: ReadWindowCoveringAttributeList() : ReadAttribute("attribute-list") { } ~ReadWindowCoveringAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringAttributeList : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeWindowCoveringAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadWindowCoveringFeatureMap : public ReadAttribute { public: ReadWindowCoveringFeatureMap() : ReadAttribute("feature-map") { } ~ReadWindowCoveringFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringFeatureMap : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeWindowCoveringFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadWindowCoveringClusterRevision : public ReadAttribute { public: ReadWindowCoveringClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadWindowCoveringClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WindowCovering::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WindowCovering ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWindowCoveringClusterRevision : public SubscribeAttribute { public: SubscribeAttributeWindowCoveringClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeWindowCoveringClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WindowCovering::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WindowCovering::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster ServiceArea | 0x0150 | |------------------------------------------------------------------------------| | Commands: | | | * SelectAreas | 0x00 | | * SkipArea | 0x02 | |------------------------------------------------------------------------------| | Attributes: | | | * SupportedAreas | 0x0000 | | * SupportedMaps | 0x0001 | | * SelectedAreas | 0x0002 | | * CurrentArea | 0x0003 | | * EstimatedEndTime | 0x0004 | | * Progress | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command SelectAreas */ class ServiceAreaSelectAreas : public ClusterCommand { public: ServiceAreaSelectAreas() : ClusterCommand("select-areas") , mComplex_NewAreas(&mRequest.newAreas) { #if MTR_ENABLE_PROVISIONAL AddArgument("NewAreas", &mComplex_NewAreas); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ServiceArea::Commands::SelectAreas::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRServiceAreaClusterSelectAreasParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.newAreas) { NSNumber * newElement_0; newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; [array_0 addObject:newElement_0]; } params.newAreas = array_0; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster selectAreasWithParams:params completion: ^(MTRServiceAreaClusterSelectAreasResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ServiceArea::Commands::SelectAreasResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ServiceArea::Commands::SelectAreasResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ServiceArea::Commands::SelectAreas::Type mRequest; TypedComplexArgument> mComplex_NewAreas; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SkipArea */ class ServiceAreaSkipArea : public ClusterCommand { public: ServiceAreaSkipArea() : ClusterCommand("skip-area") { #if MTR_ENABLE_PROVISIONAL AddArgument("SkippedArea", 0, UINT32_MAX, &mRequest.skippedArea); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ServiceArea::Commands::SkipArea::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRServiceAreaClusterSkipAreaParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.skippedArea = [NSNumber numberWithUnsignedInt:mRequest.skippedArea]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster skipAreaWithParams:params completion: ^(MTRServiceAreaClusterSkipAreaResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ServiceArea::Commands::SkipAreaResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ServiceArea::Commands::SkipAreaResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ServiceArea::Commands::SkipArea::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedAreas */ class ReadServiceAreaSupportedAreas : public ReadAttribute { public: ReadServiceAreaSupportedAreas() : ReadAttribute("supported-areas") { } ~ReadServiceAreaSupportedAreas() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ServiceArea::Attributes::SupportedAreas::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedAreasWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.SupportedAreas response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ServiceArea SupportedAreas read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeServiceAreaSupportedAreas : public SubscribeAttribute { public: SubscribeAttributeServiceAreaSupportedAreas() : SubscribeAttribute("supported-areas") { } ~SubscribeAttributeServiceAreaSupportedAreas() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ServiceArea::Attributes::SupportedAreas::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedAreasWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.SupportedAreas response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedMaps */ class ReadServiceAreaSupportedMaps : public ReadAttribute { public: ReadServiceAreaSupportedMaps() : ReadAttribute("supported-maps") { } ~ReadServiceAreaSupportedMaps() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ServiceArea::Attributes::SupportedMaps::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedMapsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.SupportedMaps response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ServiceArea SupportedMaps read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeServiceAreaSupportedMaps : public SubscribeAttribute { public: SubscribeAttributeServiceAreaSupportedMaps() : SubscribeAttribute("supported-maps") { } ~SubscribeAttributeServiceAreaSupportedMaps() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ServiceArea::Attributes::SupportedMaps::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedMapsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.SupportedMaps response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SelectedAreas */ class ReadServiceAreaSelectedAreas : public ReadAttribute { public: ReadServiceAreaSelectedAreas() : ReadAttribute("selected-areas") { } ~ReadServiceAreaSelectedAreas() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ServiceArea::Attributes::SelectedAreas::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSelectedAreasWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.SelectedAreas response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ServiceArea SelectedAreas read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeServiceAreaSelectedAreas : public SubscribeAttribute { public: SubscribeAttributeServiceAreaSelectedAreas() : SubscribeAttribute("selected-areas") { } ~SubscribeAttributeServiceAreaSelectedAreas() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ServiceArea::Attributes::SelectedAreas::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSelectedAreasWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.SelectedAreas response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentArea */ class ReadServiceAreaCurrentArea : public ReadAttribute { public: ReadServiceAreaCurrentArea() : ReadAttribute("current-area") { } ~ReadServiceAreaCurrentArea() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ServiceArea::Attributes::CurrentArea::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentAreaWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.CurrentArea response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ServiceArea CurrentArea read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeServiceAreaCurrentArea : public SubscribeAttribute { public: SubscribeAttributeServiceAreaCurrentArea() : SubscribeAttribute("current-area") { } ~SubscribeAttributeServiceAreaCurrentArea() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ServiceArea::Attributes::CurrentArea::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentAreaWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.CurrentArea response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EstimatedEndTime */ class ReadServiceAreaEstimatedEndTime : public ReadAttribute { public: ReadServiceAreaEstimatedEndTime() : ReadAttribute("estimated-end-time") { } ~ReadServiceAreaEstimatedEndTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ServiceArea::Attributes::EstimatedEndTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEstimatedEndTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.EstimatedEndTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ServiceArea EstimatedEndTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeServiceAreaEstimatedEndTime : public SubscribeAttribute { public: SubscribeAttributeServiceAreaEstimatedEndTime() : SubscribeAttribute("estimated-end-time") { } ~SubscribeAttributeServiceAreaEstimatedEndTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ServiceArea::Attributes::EstimatedEndTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEstimatedEndTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.EstimatedEndTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Progress */ class ReadServiceAreaProgress : public ReadAttribute { public: ReadServiceAreaProgress() : ReadAttribute("progress") { } ~ReadServiceAreaProgress() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ServiceArea::Attributes::Progress::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeProgressWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.Progress response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ServiceArea Progress read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeServiceAreaProgress : public SubscribeAttribute { public: SubscribeAttributeServiceAreaProgress() : SubscribeAttribute("progress") { } ~SubscribeAttributeServiceAreaProgress() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ServiceArea::Attributes::Progress::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeProgressWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.Progress response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadServiceAreaGeneratedCommandList : public ReadAttribute { public: ReadServiceAreaGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadServiceAreaGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ServiceArea::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ServiceArea GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeServiceAreaGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeServiceAreaGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeServiceAreaGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ServiceArea::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadServiceAreaAcceptedCommandList : public ReadAttribute { public: ReadServiceAreaAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadServiceAreaAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ServiceArea::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ServiceArea AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeServiceAreaAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeServiceAreaAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeServiceAreaAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ServiceArea::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadServiceAreaEventList : public ReadAttribute { public: ReadServiceAreaEventList() : ReadAttribute("event-list") { } ~ReadServiceAreaEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ServiceArea::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ServiceArea EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeServiceAreaEventList : public SubscribeAttribute { public: SubscribeAttributeServiceAreaEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeServiceAreaEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ServiceArea::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadServiceAreaAttributeList : public ReadAttribute { public: ReadServiceAreaAttributeList() : ReadAttribute("attribute-list") { } ~ReadServiceAreaAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ServiceArea::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ServiceArea AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeServiceAreaAttributeList : public SubscribeAttribute { public: SubscribeAttributeServiceAreaAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeServiceAreaAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ServiceArea::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadServiceAreaFeatureMap : public ReadAttribute { public: ReadServiceAreaFeatureMap() : ReadAttribute("feature-map") { } ~ReadServiceAreaFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ServiceArea::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ServiceArea FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeServiceAreaFeatureMap : public SubscribeAttribute { public: SubscribeAttributeServiceAreaFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeServiceAreaFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ServiceArea::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadServiceAreaClusterRevision : public ReadAttribute { public: ReadServiceAreaClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadServiceAreaClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ServiceArea::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ServiceArea ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeServiceAreaClusterRevision : public SubscribeAttribute { public: SubscribeAttributeServiceAreaClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeServiceAreaClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ServiceArea::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ServiceArea::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterServiceArea alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ServiceArea.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster PumpConfigurationAndControl | 0x0200 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MaxPressure | 0x0000 | | * MaxSpeed | 0x0001 | | * MaxFlow | 0x0002 | | * MinConstPressure | 0x0003 | | * MaxConstPressure | 0x0004 | | * MinCompPressure | 0x0005 | | * MaxCompPressure | 0x0006 | | * MinConstSpeed | 0x0007 | | * MaxConstSpeed | 0x0008 | | * MinConstFlow | 0x0009 | | * MaxConstFlow | 0x000A | | * MinConstTemp | 0x000B | | * MaxConstTemp | 0x000C | | * PumpStatus | 0x0010 | | * EffectiveOperationMode | 0x0011 | | * EffectiveControlMode | 0x0012 | | * Capacity | 0x0013 | | * Speed | 0x0014 | | * LifetimeRunningHours | 0x0015 | | * Power | 0x0016 | | * LifetimeEnergyConsumed | 0x0017 | | * OperationMode | 0x0020 | | * ControlMode | 0x0021 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * SupplyVoltageLow | 0x0000 | | * SupplyVoltageHigh | 0x0001 | | * PowerMissingPhase | 0x0002 | | * SystemPressureLow | 0x0003 | | * SystemPressureHigh | 0x0004 | | * DryRunning | 0x0005 | | * MotorTemperatureHigh | 0x0006 | | * PumpMotorFatalFailure | 0x0007 | | * ElectronicTemperatureHigh | 0x0008 | | * PumpBlocked | 0x0009 | | * SensorFailure | 0x000A | | * ElectronicNonFatalFailure | 0x000B | | * ElectronicFatalFailure | 0x000C | | * GeneralFault | 0x000D | | * Leakage | 0x000E | | * AirDetection | 0x000F | | * TurbineOperation | 0x0010 | \*----------------------------------------------------------------------------*/ /* * Attribute MaxPressure */ class ReadPumpConfigurationAndControlMaxPressure : public ReadAttribute { public: ReadPumpConfigurationAndControlMaxPressure() : ReadAttribute("max-pressure") { } ~ReadPumpConfigurationAndControlMaxPressure() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxPressure::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxPressureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxPressure response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl MaxPressure read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlMaxPressure : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlMaxPressure() : SubscribeAttribute("max-pressure") { } ~SubscribeAttributePumpConfigurationAndControlMaxPressure() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxPressure::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxPressureWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxPressure response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxSpeed */ class ReadPumpConfigurationAndControlMaxSpeed : public ReadAttribute { public: ReadPumpConfigurationAndControlMaxSpeed() : ReadAttribute("max-speed") { } ~ReadPumpConfigurationAndControlMaxSpeed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxSpeed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxSpeedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxSpeed response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl MaxSpeed read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlMaxSpeed : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlMaxSpeed() : SubscribeAttribute("max-speed") { } ~SubscribeAttributePumpConfigurationAndControlMaxSpeed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxSpeed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxSpeedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxSpeed response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxFlow */ class ReadPumpConfigurationAndControlMaxFlow : public ReadAttribute { public: ReadPumpConfigurationAndControlMaxFlow() : ReadAttribute("max-flow") { } ~ReadPumpConfigurationAndControlMaxFlow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxFlow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxFlowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxFlow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl MaxFlow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlMaxFlow : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlMaxFlow() : SubscribeAttribute("max-flow") { } ~SubscribeAttributePumpConfigurationAndControlMaxFlow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxFlow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxFlowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxFlow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinConstPressure */ class ReadPumpConfigurationAndControlMinConstPressure : public ReadAttribute { public: ReadPumpConfigurationAndControlMinConstPressure() : ReadAttribute("min-const-pressure") { } ~ReadPumpConfigurationAndControlMinConstPressure() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstPressure::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinConstPressureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MinConstPressure response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl MinConstPressure read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlMinConstPressure : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlMinConstPressure() : SubscribeAttribute("min-const-pressure") { } ~SubscribeAttributePumpConfigurationAndControlMinConstPressure() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstPressure::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinConstPressureWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MinConstPressure response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxConstPressure */ class ReadPumpConfigurationAndControlMaxConstPressure : public ReadAttribute { public: ReadPumpConfigurationAndControlMaxConstPressure() : ReadAttribute("max-const-pressure") { } ~ReadPumpConfigurationAndControlMaxConstPressure() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstPressure::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxConstPressureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxConstPressure response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl MaxConstPressure read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlMaxConstPressure : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlMaxConstPressure() : SubscribeAttribute("max-const-pressure") { } ~SubscribeAttributePumpConfigurationAndControlMaxConstPressure() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstPressure::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxConstPressureWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxConstPressure response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinCompPressure */ class ReadPumpConfigurationAndControlMinCompPressure : public ReadAttribute { public: ReadPumpConfigurationAndControlMinCompPressure() : ReadAttribute("min-comp-pressure") { } ~ReadPumpConfigurationAndControlMinCompPressure() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinCompPressure::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinCompPressureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MinCompPressure response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl MinCompPressure read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlMinCompPressure : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlMinCompPressure() : SubscribeAttribute("min-comp-pressure") { } ~SubscribeAttributePumpConfigurationAndControlMinCompPressure() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinCompPressure::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinCompPressureWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MinCompPressure response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxCompPressure */ class ReadPumpConfigurationAndControlMaxCompPressure : public ReadAttribute { public: ReadPumpConfigurationAndControlMaxCompPressure() : ReadAttribute("max-comp-pressure") { } ~ReadPumpConfigurationAndControlMaxCompPressure() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxCompPressure::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxCompPressureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxCompPressure response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl MaxCompPressure read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlMaxCompPressure : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlMaxCompPressure() : SubscribeAttribute("max-comp-pressure") { } ~SubscribeAttributePumpConfigurationAndControlMaxCompPressure() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxCompPressure::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxCompPressureWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxCompPressure response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinConstSpeed */ class ReadPumpConfigurationAndControlMinConstSpeed : public ReadAttribute { public: ReadPumpConfigurationAndControlMinConstSpeed() : ReadAttribute("min-const-speed") { } ~ReadPumpConfigurationAndControlMinConstSpeed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstSpeed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinConstSpeedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MinConstSpeed response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl MinConstSpeed read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlMinConstSpeed : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlMinConstSpeed() : SubscribeAttribute("min-const-speed") { } ~SubscribeAttributePumpConfigurationAndControlMinConstSpeed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstSpeed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinConstSpeedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MinConstSpeed response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxConstSpeed */ class ReadPumpConfigurationAndControlMaxConstSpeed : public ReadAttribute { public: ReadPumpConfigurationAndControlMaxConstSpeed() : ReadAttribute("max-const-speed") { } ~ReadPumpConfigurationAndControlMaxConstSpeed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstSpeed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxConstSpeedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxConstSpeed response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl MaxConstSpeed read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlMaxConstSpeed : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlMaxConstSpeed() : SubscribeAttribute("max-const-speed") { } ~SubscribeAttributePumpConfigurationAndControlMaxConstSpeed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstSpeed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxConstSpeedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxConstSpeed response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinConstFlow */ class ReadPumpConfigurationAndControlMinConstFlow : public ReadAttribute { public: ReadPumpConfigurationAndControlMinConstFlow() : ReadAttribute("min-const-flow") { } ~ReadPumpConfigurationAndControlMinConstFlow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstFlow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinConstFlowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MinConstFlow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl MinConstFlow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlMinConstFlow : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlMinConstFlow() : SubscribeAttribute("min-const-flow") { } ~SubscribeAttributePumpConfigurationAndControlMinConstFlow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstFlow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinConstFlowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MinConstFlow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxConstFlow */ class ReadPumpConfigurationAndControlMaxConstFlow : public ReadAttribute { public: ReadPumpConfigurationAndControlMaxConstFlow() : ReadAttribute("max-const-flow") { } ~ReadPumpConfigurationAndControlMaxConstFlow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstFlow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxConstFlowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxConstFlow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl MaxConstFlow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlMaxConstFlow : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlMaxConstFlow() : SubscribeAttribute("max-const-flow") { } ~SubscribeAttributePumpConfigurationAndControlMaxConstFlow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstFlow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxConstFlowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxConstFlow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinConstTemp */ class ReadPumpConfigurationAndControlMinConstTemp : public ReadAttribute { public: ReadPumpConfigurationAndControlMinConstTemp() : ReadAttribute("min-const-temp") { } ~ReadPumpConfigurationAndControlMinConstTemp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstTemp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinConstTempWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MinConstTemp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl MinConstTemp read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlMinConstTemp : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlMinConstTemp() : SubscribeAttribute("min-const-temp") { } ~SubscribeAttributePumpConfigurationAndControlMinConstTemp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MinConstTemp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinConstTempWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MinConstTemp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxConstTemp */ class ReadPumpConfigurationAndControlMaxConstTemp : public ReadAttribute { public: ReadPumpConfigurationAndControlMaxConstTemp() : ReadAttribute("max-const-temp") { } ~ReadPumpConfigurationAndControlMaxConstTemp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstTemp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxConstTempWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxConstTemp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl MaxConstTemp read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlMaxConstTemp : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlMaxConstTemp() : SubscribeAttribute("max-const-temp") { } ~SubscribeAttributePumpConfigurationAndControlMaxConstTemp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::MaxConstTemp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxConstTempWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxConstTemp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PumpStatus */ class ReadPumpConfigurationAndControlPumpStatus : public ReadAttribute { public: ReadPumpConfigurationAndControlPumpStatus() : ReadAttribute("pump-status") { } ~ReadPumpConfigurationAndControlPumpStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::PumpStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePumpStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.PumpStatus response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl PumpStatus read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlPumpStatus : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlPumpStatus() : SubscribeAttribute("pump-status") { } ~SubscribeAttributePumpConfigurationAndControlPumpStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::PumpStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePumpStatusWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.PumpStatus response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute EffectiveOperationMode */ class ReadPumpConfigurationAndControlEffectiveOperationMode : public ReadAttribute { public: ReadPumpConfigurationAndControlEffectiveOperationMode() : ReadAttribute("effective-operation-mode") { } ~ReadPumpConfigurationAndControlEffectiveOperationMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEffectiveOperationModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.EffectiveOperationMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl EffectiveOperationMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlEffectiveOperationMode : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlEffectiveOperationMode() : SubscribeAttribute("effective-operation-mode") { } ~SubscribeAttributePumpConfigurationAndControlEffectiveOperationMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEffectiveOperationModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.EffectiveOperationMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute EffectiveControlMode */ class ReadPumpConfigurationAndControlEffectiveControlMode : public ReadAttribute { public: ReadPumpConfigurationAndControlEffectiveControlMode() : ReadAttribute("effective-control-mode") { } ~ReadPumpConfigurationAndControlEffectiveControlMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEffectiveControlModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.EffectiveControlMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl EffectiveControlMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlEffectiveControlMode : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlEffectiveControlMode() : SubscribeAttribute("effective-control-mode") { } ~SubscribeAttributePumpConfigurationAndControlEffectiveControlMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEffectiveControlModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.EffectiveControlMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Capacity */ class ReadPumpConfigurationAndControlCapacity : public ReadAttribute { public: ReadPumpConfigurationAndControlCapacity() : ReadAttribute("capacity") { } ~ReadPumpConfigurationAndControlCapacity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::Capacity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCapacityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.Capacity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl Capacity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlCapacity : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlCapacity() : SubscribeAttribute("capacity") { } ~SubscribeAttributePumpConfigurationAndControlCapacity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::Capacity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCapacityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.Capacity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Speed */ class ReadPumpConfigurationAndControlSpeed : public ReadAttribute { public: ReadPumpConfigurationAndControlSpeed() : ReadAttribute("speed") { } ~ReadPumpConfigurationAndControlSpeed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::Speed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSpeedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.Speed response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl Speed read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlSpeed : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlSpeed() : SubscribeAttribute("speed") { } ~SubscribeAttributePumpConfigurationAndControlSpeed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::Speed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSpeedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.Speed response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LifetimeRunningHours */ class ReadPumpConfigurationAndControlLifetimeRunningHours : public ReadAttribute { public: ReadPumpConfigurationAndControlLifetimeRunningHours() : ReadAttribute("lifetime-running-hours") { } ~ReadPumpConfigurationAndControlLifetimeRunningHours() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLifetimeRunningHoursWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.LifetimeRunningHours response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl LifetimeRunningHours read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WritePumpConfigurationAndControlLifetimeRunningHours : public WriteAttribute { public: WritePumpConfigurationAndControlLifetimeRunningHours() : WriteAttribute("lifetime-running-hours") { AddArgument("attr-name", "lifetime-running-hours"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WritePumpConfigurationAndControlLifetimeRunningHours() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedInt:mValue.Value()]; } [cluster writeAttributeLifetimeRunningHoursWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("PumpConfigurationAndControl LifetimeRunningHours write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributePumpConfigurationAndControlLifetimeRunningHours : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlLifetimeRunningHours() : SubscribeAttribute("lifetime-running-hours") { } ~SubscribeAttributePumpConfigurationAndControlLifetimeRunningHours() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLifetimeRunningHoursWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.LifetimeRunningHours response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Power */ class ReadPumpConfigurationAndControlPower : public ReadAttribute { public: ReadPumpConfigurationAndControlPower() : ReadAttribute("power") { } ~ReadPumpConfigurationAndControlPower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::Power::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePowerWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.Power response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl Power read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlPower : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlPower() : SubscribeAttribute("power") { } ~SubscribeAttributePumpConfigurationAndControlPower() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::Power::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePowerWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.Power response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LifetimeEnergyConsumed */ class ReadPumpConfigurationAndControlLifetimeEnergyConsumed : public ReadAttribute { public: ReadPumpConfigurationAndControlLifetimeEnergyConsumed() : ReadAttribute("lifetime-energy-consumed") { } ~ReadPumpConfigurationAndControlLifetimeEnergyConsumed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLifetimeEnergyConsumedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.LifetimeEnergyConsumed response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl LifetimeEnergyConsumed read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WritePumpConfigurationAndControlLifetimeEnergyConsumed : public WriteAttribute { public: WritePumpConfigurationAndControlLifetimeEnergyConsumed() : WriteAttribute("lifetime-energy-consumed") { AddArgument("attr-name", "lifetime-energy-consumed"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WritePumpConfigurationAndControlLifetimeEnergyConsumed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedInt:mValue.Value()]; } [cluster writeAttributeLifetimeEnergyConsumedWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("PumpConfigurationAndControl LifetimeEnergyConsumed write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributePumpConfigurationAndControlLifetimeEnergyConsumed : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlLifetimeEnergyConsumed() : SubscribeAttribute("lifetime-energy-consumed") { } ~SubscribeAttributePumpConfigurationAndControlLifetimeEnergyConsumed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLifetimeEnergyConsumedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.LifetimeEnergyConsumed response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OperationMode */ class ReadPumpConfigurationAndControlOperationMode : public ReadAttribute { public: ReadPumpConfigurationAndControlOperationMode() : ReadAttribute("operation-mode") { } ~ReadPumpConfigurationAndControlOperationMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::OperationMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOperationModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.OperationMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl OperationMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WritePumpConfigurationAndControlOperationMode : public WriteAttribute { public: WritePumpConfigurationAndControlOperationMode() : WriteAttribute("operation-mode") { AddArgument("attr-name", "operation-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WritePumpConfigurationAndControlOperationMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::OperationMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeOperationModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("PumpConfigurationAndControl OperationMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributePumpConfigurationAndControlOperationMode : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlOperationMode() : SubscribeAttribute("operation-mode") { } ~SubscribeAttributePumpConfigurationAndControlOperationMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::OperationMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOperationModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.OperationMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ControlMode */ class ReadPumpConfigurationAndControlControlMode : public ReadAttribute { public: ReadPumpConfigurationAndControlControlMode() : ReadAttribute("control-mode") { } ~ReadPumpConfigurationAndControlControlMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::ControlMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeControlModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.ControlMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl ControlMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WritePumpConfigurationAndControlControlMode : public WriteAttribute { public: WritePumpConfigurationAndControlControlMode() : WriteAttribute("control-mode") { AddArgument("attr-name", "control-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WritePumpConfigurationAndControlControlMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::ControlMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeControlModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("PumpConfigurationAndControl ControlMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributePumpConfigurationAndControlControlMode : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlControlMode() : SubscribeAttribute("control-mode") { } ~SubscribeAttributePumpConfigurationAndControlControlMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::ControlMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeControlModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.ControlMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadPumpConfigurationAndControlGeneratedCommandList : public ReadAttribute { public: ReadPumpConfigurationAndControlGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadPumpConfigurationAndControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributePumpConfigurationAndControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadPumpConfigurationAndControlAcceptedCommandList : public ReadAttribute { public: ReadPumpConfigurationAndControlAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadPumpConfigurationAndControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributePumpConfigurationAndControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadPumpConfigurationAndControlEventList : public ReadAttribute { public: ReadPumpConfigurationAndControlEventList() : ReadAttribute("event-list") { } ~ReadPumpConfigurationAndControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlEventList : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributePumpConfigurationAndControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadPumpConfigurationAndControlAttributeList : public ReadAttribute { public: ReadPumpConfigurationAndControlAttributeList() : ReadAttribute("attribute-list") { } ~ReadPumpConfigurationAndControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlAttributeList : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributePumpConfigurationAndControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadPumpConfigurationAndControlFeatureMap : public ReadAttribute { public: ReadPumpConfigurationAndControlFeatureMap() : ReadAttribute("feature-map") { } ~ReadPumpConfigurationAndControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlFeatureMap : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributePumpConfigurationAndControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadPumpConfigurationAndControlClusterRevision : public ReadAttribute { public: ReadPumpConfigurationAndControlClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadPumpConfigurationAndControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PumpConfigurationAndControl ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePumpConfigurationAndControlClusterRevision : public SubscribeAttribute { public: SubscribeAttributePumpConfigurationAndControlClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributePumpConfigurationAndControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PumpConfigurationAndControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PumpConfigurationAndControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPumpConfigurationAndControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster Thermostat | 0x0201 | |------------------------------------------------------------------------------| | Commands: | | | * SetpointRaiseLower | 0x00 | | * SetWeeklySchedule | 0x01 | | * GetWeeklySchedule | 0x02 | | * ClearWeeklySchedule | 0x03 | | * SetActiveScheduleRequest | 0x05 | | * SetActivePresetRequest | 0x06 | | * AtomicRequest | 0xFE | |------------------------------------------------------------------------------| | Attributes: | | | * LocalTemperature | 0x0000 | | * OutdoorTemperature | 0x0001 | | * Occupancy | 0x0002 | | * AbsMinHeatSetpointLimit | 0x0003 | | * AbsMaxHeatSetpointLimit | 0x0004 | | * AbsMinCoolSetpointLimit | 0x0005 | | * AbsMaxCoolSetpointLimit | 0x0006 | | * PICoolingDemand | 0x0007 | | * PIHeatingDemand | 0x0008 | | * HVACSystemTypeConfiguration | 0x0009 | | * LocalTemperatureCalibration | 0x0010 | | * OccupiedCoolingSetpoint | 0x0011 | | * OccupiedHeatingSetpoint | 0x0012 | | * UnoccupiedCoolingSetpoint | 0x0013 | | * UnoccupiedHeatingSetpoint | 0x0014 | | * MinHeatSetpointLimit | 0x0015 | | * MaxHeatSetpointLimit | 0x0016 | | * MinCoolSetpointLimit | 0x0017 | | * MaxCoolSetpointLimit | 0x0018 | | * MinSetpointDeadBand | 0x0019 | | * RemoteSensing | 0x001A | | * ControlSequenceOfOperation | 0x001B | | * SystemMode | 0x001C | | * ThermostatRunningMode | 0x001E | | * StartOfWeek | 0x0020 | | * NumberOfWeeklyTransitions | 0x0021 | | * NumberOfDailyTransitions | 0x0022 | | * TemperatureSetpointHold | 0x0023 | | * TemperatureSetpointHoldDuration | 0x0024 | | * ThermostatProgrammingOperationMode | 0x0025 | | * ThermostatRunningState | 0x0029 | | * SetpointChangeSource | 0x0030 | | * SetpointChangeAmount | 0x0031 | | * SetpointChangeSourceTimestamp | 0x0032 | | * OccupiedSetback | 0x0034 | | * OccupiedSetbackMin | 0x0035 | | * OccupiedSetbackMax | 0x0036 | | * UnoccupiedSetback | 0x0037 | | * UnoccupiedSetbackMin | 0x0038 | | * UnoccupiedSetbackMax | 0x0039 | | * EmergencyHeatDelta | 0x003A | | * ACType | 0x0040 | | * ACCapacity | 0x0041 | | * ACRefrigerantType | 0x0042 | | * ACCompressorType | 0x0043 | | * ACErrorCode | 0x0044 | | * ACLouverPosition | 0x0045 | | * ACCoilTemperature | 0x0046 | | * ACCapacityformat | 0x0047 | | * PresetTypes | 0x0048 | | * ScheduleTypes | 0x0049 | | * NumberOfPresets | 0x004A | | * NumberOfSchedules | 0x004B | | * NumberOfScheduleTransitions | 0x004C | | * NumberOfScheduleTransitionPerDay | 0x004D | | * ActivePresetHandle | 0x004E | | * ActiveScheduleHandle | 0x004F | | * Presets | 0x0050 | | * Schedules | 0x0051 | | * SetpointHoldExpiryTimestamp | 0x0052 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command SetpointRaiseLower */ class ThermostatSetpointRaiseLower : public ClusterCommand { public: ThermostatSetpointRaiseLower() : ClusterCommand("setpoint-raise-lower") { AddArgument("Mode", 0, UINT8_MAX, &mRequest.mode); AddArgument("Amount", INT8_MIN, INT8_MAX, &mRequest.amount); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::SetpointRaiseLower::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRThermostatClusterSetpointRaiseLowerParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.mode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.mode)]; params.amount = [NSNumber numberWithChar:mRequest.amount]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setpointRaiseLowerWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Thermostat::Commands::SetpointRaiseLower::Type mRequest; }; /* * Command SetWeeklySchedule */ class ThermostatSetWeeklySchedule : public ClusterCommand { public: ThermostatSetWeeklySchedule() : ClusterCommand("set-weekly-schedule") , mComplex_Transitions(&mRequest.transitions) { AddArgument("NumberOfTransitionsForSequence", 0, UINT8_MAX, &mRequest.numberOfTransitionsForSequence); AddArgument("DayOfWeekForSequence", 0, UINT8_MAX, &mRequest.dayOfWeekForSequence); AddArgument("ModeForSequence", 0, UINT8_MAX, &mRequest.modeForSequence); AddArgument("Transitions", &mComplex_Transitions); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::SetWeeklySchedule::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRThermostatClusterSetWeeklyScheduleParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.numberOfTransitionsForSequence = [NSNumber numberWithUnsignedChar:mRequest.numberOfTransitionsForSequence]; params.dayOfWeekForSequence = [NSNumber numberWithUnsignedChar:mRequest.dayOfWeekForSequence.Raw()]; params.modeForSequence = [NSNumber numberWithUnsignedChar:mRequest.modeForSequence.Raw()]; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.transitions) { MTRThermostatClusterWeeklyScheduleTransitionStruct * newElement_0; newElement_0 = [MTRThermostatClusterWeeklyScheduleTransitionStruct new]; newElement_0.transitionTime = [NSNumber numberWithUnsignedShort:entry_0.transitionTime]; if (entry_0.heatSetpoint.IsNull()) { newElement_0.heatSetpoint = nil; } else { newElement_0.heatSetpoint = [NSNumber numberWithShort:entry_0.heatSetpoint.Value()]; } if (entry_0.coolSetpoint.IsNull()) { newElement_0.coolSetpoint = nil; } else { newElement_0.coolSetpoint = [NSNumber numberWithShort:entry_0.coolSetpoint.Value()]; } [array_0 addObject:newElement_0]; } params.transitions = array_0; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setWeeklyScheduleWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Thermostat::Commands::SetWeeklySchedule::Type mRequest; TypedComplexArgument> mComplex_Transitions; }; /* * Command GetWeeklySchedule */ class ThermostatGetWeeklySchedule : public ClusterCommand { public: ThermostatGetWeeklySchedule() : ClusterCommand("get-weekly-schedule") { AddArgument("DaysToReturn", 0, UINT8_MAX, &mRequest.daysToReturn); AddArgument("ModeToReturn", 0, UINT8_MAX, &mRequest.modeToReturn); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::GetWeeklySchedule::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRThermostatClusterGetWeeklyScheduleParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.daysToReturn = [NSNumber numberWithUnsignedChar:mRequest.daysToReturn.Raw()]; params.modeToReturn = [NSNumber numberWithUnsignedChar:mRequest.modeToReturn.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster getWeeklyScheduleWithParams:params completion: ^(MTRThermostatClusterGetWeeklyScheduleResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::Thermostat::Commands::GetWeeklyScheduleResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::Thermostat::Commands::GetWeeklyScheduleResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Thermostat::Commands::GetWeeklySchedule::Type mRequest; }; /* * Command ClearWeeklySchedule */ class ThermostatClearWeeklySchedule : public ClusterCommand { public: ThermostatClearWeeklySchedule() : ClusterCommand("clear-weekly-schedule") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::ClearWeeklySchedule::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRThermostatClusterClearWeeklyScheduleParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster clearWeeklyScheduleWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #if MTR_ENABLE_PROVISIONAL /* * Command SetActiveScheduleRequest */ class ThermostatSetActiveScheduleRequest : public ClusterCommand { public: ThermostatSetActiveScheduleRequest() : ClusterCommand("set-active-schedule-request") { #if MTR_ENABLE_PROVISIONAL AddArgument("ScheduleHandle", &mRequest.scheduleHandle); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::SetActiveScheduleRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRThermostatClusterSetActiveScheduleRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.scheduleHandle = [NSData dataWithBytes:mRequest.scheduleHandle.data() length:mRequest.scheduleHandle.size()]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setActiveScheduleRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Thermostat::Commands::SetActiveScheduleRequest::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetActivePresetRequest */ class ThermostatSetActivePresetRequest : public ClusterCommand { public: ThermostatSetActivePresetRequest() : ClusterCommand("set-active-preset-request") { #if MTR_ENABLE_PROVISIONAL AddArgument("PresetHandle", &mRequest.presetHandle); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::SetActivePresetRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRThermostatClusterSetActivePresetRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.presetHandle.IsNull()) { params.presetHandle = nil; } else { params.presetHandle = [NSData dataWithBytes:mRequest.presetHandle.Value().data() length:mRequest.presetHandle.Value().size()]; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setActivePresetRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Thermostat::Commands::SetActivePresetRequest::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command AtomicRequest */ class ThermostatAtomicRequest : public ClusterCommand { public: ThermostatAtomicRequest() : ClusterCommand("atomic-request") , mComplex_AttributeRequests(&mRequest.attributeRequests) { #if MTR_ENABLE_PROVISIONAL AddArgument("RequestType", 0, UINT8_MAX, &mRequest.requestType); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("AttributeRequests", &mComplex_AttributeRequests); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Timeout", 0, UINT16_MAX, &mRequest.timeout); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Thermostat::Commands::AtomicRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRThermostatClusterAtomicRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.requestType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.requestType)]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.attributeRequests) { NSNumber * newElement_0; newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; [array_0 addObject:newElement_0]; } params.attributeRequests = array_0; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.timeout.HasValue()) { params.timeout = [NSNumber numberWithUnsignedShort:mRequest.timeout.Value()]; } else { params.timeout = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster atomicRequestWithParams:params completion: ^(MTRThermostatClusterAtomicResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::Thermostat::Commands::AtomicResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::Thermostat::Commands::AtomicResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Thermostat::Commands::AtomicRequest::Type mRequest; TypedComplexArgument> mComplex_AttributeRequests; }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute LocalTemperature */ class ReadThermostatLocalTemperature : public ReadAttribute { public: ReadThermostatLocalTemperature() : ReadAttribute("local-temperature") { } ~ReadThermostatLocalTemperature() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::LocalTemperature::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLocalTemperatureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.LocalTemperature response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat LocalTemperature read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatLocalTemperature : public SubscribeAttribute { public: SubscribeAttributeThermostatLocalTemperature() : SubscribeAttribute("local-temperature") { } ~SubscribeAttributeThermostatLocalTemperature() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::LocalTemperature::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLocalTemperatureWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.LocalTemperature response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OutdoorTemperature */ class ReadThermostatOutdoorTemperature : public ReadAttribute { public: ReadThermostatOutdoorTemperature() : ReadAttribute("outdoor-temperature") { } ~ReadThermostatOutdoorTemperature() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::OutdoorTemperature::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOutdoorTemperatureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.OutdoorTemperature response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat OutdoorTemperature read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatOutdoorTemperature : public SubscribeAttribute { public: SubscribeAttributeThermostatOutdoorTemperature() : SubscribeAttribute("outdoor-temperature") { } ~SubscribeAttributeThermostatOutdoorTemperature() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::OutdoorTemperature::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOutdoorTemperatureWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.OutdoorTemperature response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Occupancy */ class ReadThermostatOccupancy : public ReadAttribute { public: ReadThermostatOccupancy() : ReadAttribute("occupancy") { } ~ReadThermostatOccupancy() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::Occupancy::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOccupancyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.Occupancy response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat Occupancy read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatOccupancy : public SubscribeAttribute { public: SubscribeAttributeThermostatOccupancy() : SubscribeAttribute("occupancy") { } ~SubscribeAttributeThermostatOccupancy() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::Occupancy::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOccupancyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.Occupancy response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AbsMinHeatSetpointLimit */ class ReadThermostatAbsMinHeatSetpointLimit : public ReadAttribute { public: ReadThermostatAbsMinHeatSetpointLimit() : ReadAttribute("abs-min-heat-setpoint-limit") { } ~ReadThermostatAbsMinHeatSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::AbsMinHeatSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAbsMinHeatSetpointLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AbsMinHeatSetpointLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat AbsMinHeatSetpointLimit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatAbsMinHeatSetpointLimit : public SubscribeAttribute { public: SubscribeAttributeThermostatAbsMinHeatSetpointLimit() : SubscribeAttribute("abs-min-heat-setpoint-limit") { } ~SubscribeAttributeThermostatAbsMinHeatSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::AbsMinHeatSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAbsMinHeatSetpointLimitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AbsMinHeatSetpointLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AbsMaxHeatSetpointLimit */ class ReadThermostatAbsMaxHeatSetpointLimit : public ReadAttribute { public: ReadThermostatAbsMaxHeatSetpointLimit() : ReadAttribute("abs-max-heat-setpoint-limit") { } ~ReadThermostatAbsMaxHeatSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::AbsMaxHeatSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAbsMaxHeatSetpointLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AbsMaxHeatSetpointLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat AbsMaxHeatSetpointLimit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatAbsMaxHeatSetpointLimit : public SubscribeAttribute { public: SubscribeAttributeThermostatAbsMaxHeatSetpointLimit() : SubscribeAttribute("abs-max-heat-setpoint-limit") { } ~SubscribeAttributeThermostatAbsMaxHeatSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::AbsMaxHeatSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAbsMaxHeatSetpointLimitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AbsMaxHeatSetpointLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AbsMinCoolSetpointLimit */ class ReadThermostatAbsMinCoolSetpointLimit : public ReadAttribute { public: ReadThermostatAbsMinCoolSetpointLimit() : ReadAttribute("abs-min-cool-setpoint-limit") { } ~ReadThermostatAbsMinCoolSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::AbsMinCoolSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAbsMinCoolSetpointLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AbsMinCoolSetpointLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat AbsMinCoolSetpointLimit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatAbsMinCoolSetpointLimit : public SubscribeAttribute { public: SubscribeAttributeThermostatAbsMinCoolSetpointLimit() : SubscribeAttribute("abs-min-cool-setpoint-limit") { } ~SubscribeAttributeThermostatAbsMinCoolSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::AbsMinCoolSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAbsMinCoolSetpointLimitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AbsMinCoolSetpointLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AbsMaxCoolSetpointLimit */ class ReadThermostatAbsMaxCoolSetpointLimit : public ReadAttribute { public: ReadThermostatAbsMaxCoolSetpointLimit() : ReadAttribute("abs-max-cool-setpoint-limit") { } ~ReadThermostatAbsMaxCoolSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::AbsMaxCoolSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAbsMaxCoolSetpointLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AbsMaxCoolSetpointLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat AbsMaxCoolSetpointLimit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatAbsMaxCoolSetpointLimit : public SubscribeAttribute { public: SubscribeAttributeThermostatAbsMaxCoolSetpointLimit() : SubscribeAttribute("abs-max-cool-setpoint-limit") { } ~SubscribeAttributeThermostatAbsMaxCoolSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::AbsMaxCoolSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAbsMaxCoolSetpointLimitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AbsMaxCoolSetpointLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PICoolingDemand */ class ReadThermostatPICoolingDemand : public ReadAttribute { public: ReadThermostatPICoolingDemand() : ReadAttribute("picooling-demand") { } ~ReadThermostatPICoolingDemand() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::PICoolingDemand::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePICoolingDemandWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.PICoolingDemand response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat PICoolingDemand read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatPICoolingDemand : public SubscribeAttribute { public: SubscribeAttributeThermostatPICoolingDemand() : SubscribeAttribute("picooling-demand") { } ~SubscribeAttributeThermostatPICoolingDemand() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::PICoolingDemand::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePICoolingDemandWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.PICoolingDemand response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PIHeatingDemand */ class ReadThermostatPIHeatingDemand : public ReadAttribute { public: ReadThermostatPIHeatingDemand() : ReadAttribute("piheating-demand") { } ~ReadThermostatPIHeatingDemand() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::PIHeatingDemand::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePIHeatingDemandWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.PIHeatingDemand response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat PIHeatingDemand read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatPIHeatingDemand : public SubscribeAttribute { public: SubscribeAttributeThermostatPIHeatingDemand() : SubscribeAttribute("piheating-demand") { } ~SubscribeAttributeThermostatPIHeatingDemand() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::PIHeatingDemand::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePIHeatingDemandWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.PIHeatingDemand response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute HVACSystemTypeConfiguration */ class ReadThermostatHVACSystemTypeConfiguration : public ReadAttribute { public: ReadThermostatHVACSystemTypeConfiguration() : ReadAttribute("hvacsystem-type-configuration") { } ~ReadThermostatHVACSystemTypeConfiguration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::HVACSystemTypeConfiguration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeHVACSystemTypeConfigurationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.HVACSystemTypeConfiguration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat HVACSystemTypeConfiguration read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatHVACSystemTypeConfiguration : public WriteAttribute { public: WriteThermostatHVACSystemTypeConfiguration() : WriteAttribute("hvacsystem-type-configuration") { AddArgument("attr-name", "hvacsystem-type-configuration"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatHVACSystemTypeConfiguration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::HVACSystemTypeConfiguration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeHVACSystemTypeConfigurationWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat HVACSystemTypeConfiguration write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeThermostatHVACSystemTypeConfiguration : public SubscribeAttribute { public: SubscribeAttributeThermostatHVACSystemTypeConfiguration() : SubscribeAttribute("hvacsystem-type-configuration") { } ~SubscribeAttributeThermostatHVACSystemTypeConfiguration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::HVACSystemTypeConfiguration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeHVACSystemTypeConfigurationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.HVACSystemTypeConfiguration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LocalTemperatureCalibration */ class ReadThermostatLocalTemperatureCalibration : public ReadAttribute { public: ReadThermostatLocalTemperatureCalibration() : ReadAttribute("local-temperature-calibration") { } ~ReadThermostatLocalTemperatureCalibration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::LocalTemperatureCalibration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLocalTemperatureCalibrationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.LocalTemperatureCalibration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat LocalTemperatureCalibration read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatLocalTemperatureCalibration : public WriteAttribute { public: WriteThermostatLocalTemperatureCalibration() : WriteAttribute("local-temperature-calibration") { AddArgument("attr-name", "local-temperature-calibration"); AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatLocalTemperatureCalibration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::LocalTemperatureCalibration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithChar:mValue]; [cluster writeAttributeLocalTemperatureCalibrationWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat LocalTemperatureCalibration write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int8_t mValue; }; class SubscribeAttributeThermostatLocalTemperatureCalibration : public SubscribeAttribute { public: SubscribeAttributeThermostatLocalTemperatureCalibration() : SubscribeAttribute("local-temperature-calibration") { } ~SubscribeAttributeThermostatLocalTemperatureCalibration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::LocalTemperatureCalibration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLocalTemperatureCalibrationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.LocalTemperatureCalibration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OccupiedCoolingSetpoint */ class ReadThermostatOccupiedCoolingSetpoint : public ReadAttribute { public: ReadThermostatOccupiedCoolingSetpoint() : ReadAttribute("occupied-cooling-setpoint") { } ~ReadThermostatOccupiedCoolingSetpoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::OccupiedCoolingSetpoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOccupiedCoolingSetpointWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.OccupiedCoolingSetpoint response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat OccupiedCoolingSetpoint read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatOccupiedCoolingSetpoint : public WriteAttribute { public: WriteThermostatOccupiedCoolingSetpoint() : WriteAttribute("occupied-cooling-setpoint") { AddArgument("attr-name", "occupied-cooling-setpoint"); AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatOccupiedCoolingSetpoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::OccupiedCoolingSetpoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; [cluster writeAttributeOccupiedCoolingSetpointWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat OccupiedCoolingSetpoint write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int16_t mValue; }; class SubscribeAttributeThermostatOccupiedCoolingSetpoint : public SubscribeAttribute { public: SubscribeAttributeThermostatOccupiedCoolingSetpoint() : SubscribeAttribute("occupied-cooling-setpoint") { } ~SubscribeAttributeThermostatOccupiedCoolingSetpoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::OccupiedCoolingSetpoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOccupiedCoolingSetpointWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.OccupiedCoolingSetpoint response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OccupiedHeatingSetpoint */ class ReadThermostatOccupiedHeatingSetpoint : public ReadAttribute { public: ReadThermostatOccupiedHeatingSetpoint() : ReadAttribute("occupied-heating-setpoint") { } ~ReadThermostatOccupiedHeatingSetpoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::OccupiedHeatingSetpoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOccupiedHeatingSetpointWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.OccupiedHeatingSetpoint response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat OccupiedHeatingSetpoint read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatOccupiedHeatingSetpoint : public WriteAttribute { public: WriteThermostatOccupiedHeatingSetpoint() : WriteAttribute("occupied-heating-setpoint") { AddArgument("attr-name", "occupied-heating-setpoint"); AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatOccupiedHeatingSetpoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::OccupiedHeatingSetpoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; [cluster writeAttributeOccupiedHeatingSetpointWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat OccupiedHeatingSetpoint write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int16_t mValue; }; class SubscribeAttributeThermostatOccupiedHeatingSetpoint : public SubscribeAttribute { public: SubscribeAttributeThermostatOccupiedHeatingSetpoint() : SubscribeAttribute("occupied-heating-setpoint") { } ~SubscribeAttributeThermostatOccupiedHeatingSetpoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::OccupiedHeatingSetpoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOccupiedHeatingSetpointWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.OccupiedHeatingSetpoint response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute UnoccupiedCoolingSetpoint */ class ReadThermostatUnoccupiedCoolingSetpoint : public ReadAttribute { public: ReadThermostatUnoccupiedCoolingSetpoint() : ReadAttribute("unoccupied-cooling-setpoint") { } ~ReadThermostatUnoccupiedCoolingSetpoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::UnoccupiedCoolingSetpoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUnoccupiedCoolingSetpointWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.UnoccupiedCoolingSetpoint response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat UnoccupiedCoolingSetpoint read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatUnoccupiedCoolingSetpoint : public WriteAttribute { public: WriteThermostatUnoccupiedCoolingSetpoint() : WriteAttribute("unoccupied-cooling-setpoint") { AddArgument("attr-name", "unoccupied-cooling-setpoint"); AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatUnoccupiedCoolingSetpoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::UnoccupiedCoolingSetpoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; [cluster writeAttributeUnoccupiedCoolingSetpointWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat UnoccupiedCoolingSetpoint write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int16_t mValue; }; class SubscribeAttributeThermostatUnoccupiedCoolingSetpoint : public SubscribeAttribute { public: SubscribeAttributeThermostatUnoccupiedCoolingSetpoint() : SubscribeAttribute("unoccupied-cooling-setpoint") { } ~SubscribeAttributeThermostatUnoccupiedCoolingSetpoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::UnoccupiedCoolingSetpoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUnoccupiedCoolingSetpointWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.UnoccupiedCoolingSetpoint response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute UnoccupiedHeatingSetpoint */ class ReadThermostatUnoccupiedHeatingSetpoint : public ReadAttribute { public: ReadThermostatUnoccupiedHeatingSetpoint() : ReadAttribute("unoccupied-heating-setpoint") { } ~ReadThermostatUnoccupiedHeatingSetpoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::UnoccupiedHeatingSetpoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUnoccupiedHeatingSetpointWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.UnoccupiedHeatingSetpoint response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat UnoccupiedHeatingSetpoint read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatUnoccupiedHeatingSetpoint : public WriteAttribute { public: WriteThermostatUnoccupiedHeatingSetpoint() : WriteAttribute("unoccupied-heating-setpoint") { AddArgument("attr-name", "unoccupied-heating-setpoint"); AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatUnoccupiedHeatingSetpoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::UnoccupiedHeatingSetpoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; [cluster writeAttributeUnoccupiedHeatingSetpointWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat UnoccupiedHeatingSetpoint write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int16_t mValue; }; class SubscribeAttributeThermostatUnoccupiedHeatingSetpoint : public SubscribeAttribute { public: SubscribeAttributeThermostatUnoccupiedHeatingSetpoint() : SubscribeAttribute("unoccupied-heating-setpoint") { } ~SubscribeAttributeThermostatUnoccupiedHeatingSetpoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::UnoccupiedHeatingSetpoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUnoccupiedHeatingSetpointWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.UnoccupiedHeatingSetpoint response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinHeatSetpointLimit */ class ReadThermostatMinHeatSetpointLimit : public ReadAttribute { public: ReadThermostatMinHeatSetpointLimit() : ReadAttribute("min-heat-setpoint-limit") { } ~ReadThermostatMinHeatSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::MinHeatSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinHeatSetpointLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.MinHeatSetpointLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat MinHeatSetpointLimit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatMinHeatSetpointLimit : public WriteAttribute { public: WriteThermostatMinHeatSetpointLimit() : WriteAttribute("min-heat-setpoint-limit") { AddArgument("attr-name", "min-heat-setpoint-limit"); AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatMinHeatSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::MinHeatSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; [cluster writeAttributeMinHeatSetpointLimitWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat MinHeatSetpointLimit write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int16_t mValue; }; class SubscribeAttributeThermostatMinHeatSetpointLimit : public SubscribeAttribute { public: SubscribeAttributeThermostatMinHeatSetpointLimit() : SubscribeAttribute("min-heat-setpoint-limit") { } ~SubscribeAttributeThermostatMinHeatSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::MinHeatSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinHeatSetpointLimitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.MinHeatSetpointLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxHeatSetpointLimit */ class ReadThermostatMaxHeatSetpointLimit : public ReadAttribute { public: ReadThermostatMaxHeatSetpointLimit() : ReadAttribute("max-heat-setpoint-limit") { } ~ReadThermostatMaxHeatSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::MaxHeatSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxHeatSetpointLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.MaxHeatSetpointLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat MaxHeatSetpointLimit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatMaxHeatSetpointLimit : public WriteAttribute { public: WriteThermostatMaxHeatSetpointLimit() : WriteAttribute("max-heat-setpoint-limit") { AddArgument("attr-name", "max-heat-setpoint-limit"); AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatMaxHeatSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::MaxHeatSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; [cluster writeAttributeMaxHeatSetpointLimitWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat MaxHeatSetpointLimit write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int16_t mValue; }; class SubscribeAttributeThermostatMaxHeatSetpointLimit : public SubscribeAttribute { public: SubscribeAttributeThermostatMaxHeatSetpointLimit() : SubscribeAttribute("max-heat-setpoint-limit") { } ~SubscribeAttributeThermostatMaxHeatSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::MaxHeatSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxHeatSetpointLimitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.MaxHeatSetpointLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinCoolSetpointLimit */ class ReadThermostatMinCoolSetpointLimit : public ReadAttribute { public: ReadThermostatMinCoolSetpointLimit() : ReadAttribute("min-cool-setpoint-limit") { } ~ReadThermostatMinCoolSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::MinCoolSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinCoolSetpointLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.MinCoolSetpointLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat MinCoolSetpointLimit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatMinCoolSetpointLimit : public WriteAttribute { public: WriteThermostatMinCoolSetpointLimit() : WriteAttribute("min-cool-setpoint-limit") { AddArgument("attr-name", "min-cool-setpoint-limit"); AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatMinCoolSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::MinCoolSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; [cluster writeAttributeMinCoolSetpointLimitWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat MinCoolSetpointLimit write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int16_t mValue; }; class SubscribeAttributeThermostatMinCoolSetpointLimit : public SubscribeAttribute { public: SubscribeAttributeThermostatMinCoolSetpointLimit() : SubscribeAttribute("min-cool-setpoint-limit") { } ~SubscribeAttributeThermostatMinCoolSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::MinCoolSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinCoolSetpointLimitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.MinCoolSetpointLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxCoolSetpointLimit */ class ReadThermostatMaxCoolSetpointLimit : public ReadAttribute { public: ReadThermostatMaxCoolSetpointLimit() : ReadAttribute("max-cool-setpoint-limit") { } ~ReadThermostatMaxCoolSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::MaxCoolSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxCoolSetpointLimitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.MaxCoolSetpointLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat MaxCoolSetpointLimit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatMaxCoolSetpointLimit : public WriteAttribute { public: WriteThermostatMaxCoolSetpointLimit() : WriteAttribute("max-cool-setpoint-limit") { AddArgument("attr-name", "max-cool-setpoint-limit"); AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatMaxCoolSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::MaxCoolSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; [cluster writeAttributeMaxCoolSetpointLimitWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat MaxCoolSetpointLimit write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int16_t mValue; }; class SubscribeAttributeThermostatMaxCoolSetpointLimit : public SubscribeAttribute { public: SubscribeAttributeThermostatMaxCoolSetpointLimit() : SubscribeAttribute("max-cool-setpoint-limit") { } ~SubscribeAttributeThermostatMaxCoolSetpointLimit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::MaxCoolSetpointLimit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxCoolSetpointLimitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.MaxCoolSetpointLimit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinSetpointDeadBand */ class ReadThermostatMinSetpointDeadBand : public ReadAttribute { public: ReadThermostatMinSetpointDeadBand() : ReadAttribute("min-setpoint-dead-band") { } ~ReadThermostatMinSetpointDeadBand() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::MinSetpointDeadBand::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinSetpointDeadBandWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.MinSetpointDeadBand response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat MinSetpointDeadBand read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatMinSetpointDeadBand : public WriteAttribute { public: WriteThermostatMinSetpointDeadBand() : WriteAttribute("min-setpoint-dead-band") { AddArgument("attr-name", "min-setpoint-dead-band"); AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatMinSetpointDeadBand() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::MinSetpointDeadBand::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithChar:mValue]; [cluster writeAttributeMinSetpointDeadBandWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat MinSetpointDeadBand write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int8_t mValue; }; class SubscribeAttributeThermostatMinSetpointDeadBand : public SubscribeAttribute { public: SubscribeAttributeThermostatMinSetpointDeadBand() : SubscribeAttribute("min-setpoint-dead-band") { } ~SubscribeAttributeThermostatMinSetpointDeadBand() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::MinSetpointDeadBand::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinSetpointDeadBandWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.MinSetpointDeadBand response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RemoteSensing */ class ReadThermostatRemoteSensing : public ReadAttribute { public: ReadThermostatRemoteSensing() : ReadAttribute("remote-sensing") { } ~ReadThermostatRemoteSensing() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::RemoteSensing::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRemoteSensingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.RemoteSensing response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat RemoteSensing read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatRemoteSensing : public WriteAttribute { public: WriteThermostatRemoteSensing() : WriteAttribute("remote-sensing") { AddArgument("attr-name", "remote-sensing"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatRemoteSensing() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::RemoteSensing::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeRemoteSensingWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat RemoteSensing write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeThermostatRemoteSensing : public SubscribeAttribute { public: SubscribeAttributeThermostatRemoteSensing() : SubscribeAttribute("remote-sensing") { } ~SubscribeAttributeThermostatRemoteSensing() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::RemoteSensing::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRemoteSensingWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.RemoteSensing response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ControlSequenceOfOperation */ class ReadThermostatControlSequenceOfOperation : public ReadAttribute { public: ReadThermostatControlSequenceOfOperation() : ReadAttribute("control-sequence-of-operation") { } ~ReadThermostatControlSequenceOfOperation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ControlSequenceOfOperation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeControlSequenceOfOperationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ControlSequenceOfOperation response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat ControlSequenceOfOperation read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatControlSequenceOfOperation : public WriteAttribute { public: WriteThermostatControlSequenceOfOperation() : WriteAttribute("control-sequence-of-operation") { AddArgument("attr-name", "control-sequence-of-operation"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatControlSequenceOfOperation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ControlSequenceOfOperation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeControlSequenceOfOperationWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat ControlSequenceOfOperation write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeThermostatControlSequenceOfOperation : public SubscribeAttribute { public: SubscribeAttributeThermostatControlSequenceOfOperation() : SubscribeAttribute("control-sequence-of-operation") { } ~SubscribeAttributeThermostatControlSequenceOfOperation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ControlSequenceOfOperation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeControlSequenceOfOperationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ControlSequenceOfOperation response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SystemMode */ class ReadThermostatSystemMode : public ReadAttribute { public: ReadThermostatSystemMode() : ReadAttribute("system-mode") { } ~ReadThermostatSystemMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::SystemMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSystemModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.SystemMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat SystemMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatSystemMode : public WriteAttribute { public: WriteThermostatSystemMode() : WriteAttribute("system-mode") { AddArgument("attr-name", "system-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatSystemMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::SystemMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeSystemModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat SystemMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeThermostatSystemMode : public SubscribeAttribute { public: SubscribeAttributeThermostatSystemMode() : SubscribeAttribute("system-mode") { } ~SubscribeAttributeThermostatSystemMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::SystemMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSystemModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.SystemMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ThermostatRunningMode */ class ReadThermostatThermostatRunningMode : public ReadAttribute { public: ReadThermostatThermostatRunningMode() : ReadAttribute("thermostat-running-mode") { } ~ReadThermostatThermostatRunningMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ThermostatRunningMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeThermostatRunningModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ThermostatRunningMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat ThermostatRunningMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatThermostatRunningMode : public SubscribeAttribute { public: SubscribeAttributeThermostatThermostatRunningMode() : SubscribeAttribute("thermostat-running-mode") { } ~SubscribeAttributeThermostatThermostatRunningMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ThermostatRunningMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeThermostatRunningModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ThermostatRunningMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute StartOfWeek */ class ReadThermostatStartOfWeek : public ReadAttribute { public: ReadThermostatStartOfWeek() : ReadAttribute("start-of-week") { } ~ReadThermostatStartOfWeek() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::StartOfWeek::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStartOfWeekWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.StartOfWeek response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat StartOfWeek read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatStartOfWeek : public SubscribeAttribute { public: SubscribeAttributeThermostatStartOfWeek() : SubscribeAttribute("start-of-week") { } ~SubscribeAttributeThermostatStartOfWeek() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::StartOfWeek::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStartOfWeekWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.StartOfWeek response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NumberOfWeeklyTransitions */ class ReadThermostatNumberOfWeeklyTransitions : public ReadAttribute { public: ReadThermostatNumberOfWeeklyTransitions() : ReadAttribute("number-of-weekly-transitions") { } ~ReadThermostatNumberOfWeeklyTransitions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::NumberOfWeeklyTransitions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfWeeklyTransitionsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.NumberOfWeeklyTransitions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat NumberOfWeeklyTransitions read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatNumberOfWeeklyTransitions : public SubscribeAttribute { public: SubscribeAttributeThermostatNumberOfWeeklyTransitions() : SubscribeAttribute("number-of-weekly-transitions") { } ~SubscribeAttributeThermostatNumberOfWeeklyTransitions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::NumberOfWeeklyTransitions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfWeeklyTransitionsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.NumberOfWeeklyTransitions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NumberOfDailyTransitions */ class ReadThermostatNumberOfDailyTransitions : public ReadAttribute { public: ReadThermostatNumberOfDailyTransitions() : ReadAttribute("number-of-daily-transitions") { } ~ReadThermostatNumberOfDailyTransitions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::NumberOfDailyTransitions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfDailyTransitionsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.NumberOfDailyTransitions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat NumberOfDailyTransitions read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatNumberOfDailyTransitions : public SubscribeAttribute { public: SubscribeAttributeThermostatNumberOfDailyTransitions() : SubscribeAttribute("number-of-daily-transitions") { } ~SubscribeAttributeThermostatNumberOfDailyTransitions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::NumberOfDailyTransitions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfDailyTransitionsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.NumberOfDailyTransitions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TemperatureSetpointHold */ class ReadThermostatTemperatureSetpointHold : public ReadAttribute { public: ReadThermostatTemperatureSetpointHold() : ReadAttribute("temperature-setpoint-hold") { } ~ReadThermostatTemperatureSetpointHold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::TemperatureSetpointHold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTemperatureSetpointHoldWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.TemperatureSetpointHold response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat TemperatureSetpointHold read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatTemperatureSetpointHold : public WriteAttribute { public: WriteThermostatTemperatureSetpointHold() : WriteAttribute("temperature-setpoint-hold") { AddArgument("attr-name", "temperature-setpoint-hold"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatTemperatureSetpointHold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::TemperatureSetpointHold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeTemperatureSetpointHoldWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat TemperatureSetpointHold write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeThermostatTemperatureSetpointHold : public SubscribeAttribute { public: SubscribeAttributeThermostatTemperatureSetpointHold() : SubscribeAttribute("temperature-setpoint-hold") { } ~SubscribeAttributeThermostatTemperatureSetpointHold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::TemperatureSetpointHold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTemperatureSetpointHoldWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.TemperatureSetpointHold response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TemperatureSetpointHoldDuration */ class ReadThermostatTemperatureSetpointHoldDuration : public ReadAttribute { public: ReadThermostatTemperatureSetpointHoldDuration() : ReadAttribute("temperature-setpoint-hold-duration") { } ~ReadThermostatTemperatureSetpointHoldDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::TemperatureSetpointHoldDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTemperatureSetpointHoldDurationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.TemperatureSetpointHoldDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat TemperatureSetpointHoldDuration read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatTemperatureSetpointHoldDuration : public WriteAttribute { public: WriteThermostatTemperatureSetpointHoldDuration() : WriteAttribute("temperature-setpoint-hold-duration") { AddArgument("attr-name", "temperature-setpoint-hold-duration"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatTemperatureSetpointHoldDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::TemperatureSetpointHoldDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedShort:mValue.Value()]; } [cluster writeAttributeTemperatureSetpointHoldDurationWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat TemperatureSetpointHoldDuration write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeThermostatTemperatureSetpointHoldDuration : public SubscribeAttribute { public: SubscribeAttributeThermostatTemperatureSetpointHoldDuration() : SubscribeAttribute("temperature-setpoint-hold-duration") { } ~SubscribeAttributeThermostatTemperatureSetpointHoldDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::TemperatureSetpointHoldDuration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTemperatureSetpointHoldDurationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.TemperatureSetpointHoldDuration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ThermostatProgrammingOperationMode */ class ReadThermostatThermostatProgrammingOperationMode : public ReadAttribute { public: ReadThermostatThermostatProgrammingOperationMode() : ReadAttribute("thermostat-programming-operation-mode") { } ~ReadThermostatThermostatProgrammingOperationMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ThermostatProgrammingOperationMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeThermostatProgrammingOperationModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ThermostatProgrammingOperationMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat ThermostatProgrammingOperationMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatThermostatProgrammingOperationMode : public WriteAttribute { public: WriteThermostatThermostatProgrammingOperationMode() : WriteAttribute("thermostat-programming-operation-mode") { AddArgument("attr-name", "thermostat-programming-operation-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatThermostatProgrammingOperationMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ThermostatProgrammingOperationMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeThermostatProgrammingOperationModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat ThermostatProgrammingOperationMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeThermostatThermostatProgrammingOperationMode : public SubscribeAttribute { public: SubscribeAttributeThermostatThermostatProgrammingOperationMode() : SubscribeAttribute("thermostat-programming-operation-mode") { } ~SubscribeAttributeThermostatThermostatProgrammingOperationMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ThermostatProgrammingOperationMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeThermostatProgrammingOperationModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ThermostatProgrammingOperationMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ThermostatRunningState */ class ReadThermostatThermostatRunningState : public ReadAttribute { public: ReadThermostatThermostatRunningState() : ReadAttribute("thermostat-running-state") { } ~ReadThermostatThermostatRunningState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ThermostatRunningState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeThermostatRunningStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ThermostatRunningState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat ThermostatRunningState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatThermostatRunningState : public SubscribeAttribute { public: SubscribeAttributeThermostatThermostatRunningState() : SubscribeAttribute("thermostat-running-state") { } ~SubscribeAttributeThermostatThermostatRunningState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ThermostatRunningState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeThermostatRunningStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ThermostatRunningState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SetpointChangeSource */ class ReadThermostatSetpointChangeSource : public ReadAttribute { public: ReadThermostatSetpointChangeSource() : ReadAttribute("setpoint-change-source") { } ~ReadThermostatSetpointChangeSource() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::SetpointChangeSource::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSetpointChangeSourceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.SetpointChangeSource response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat SetpointChangeSource read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatSetpointChangeSource : public SubscribeAttribute { public: SubscribeAttributeThermostatSetpointChangeSource() : SubscribeAttribute("setpoint-change-source") { } ~SubscribeAttributeThermostatSetpointChangeSource() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::SetpointChangeSource::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSetpointChangeSourceWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.SetpointChangeSource response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SetpointChangeAmount */ class ReadThermostatSetpointChangeAmount : public ReadAttribute { public: ReadThermostatSetpointChangeAmount() : ReadAttribute("setpoint-change-amount") { } ~ReadThermostatSetpointChangeAmount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::SetpointChangeAmount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSetpointChangeAmountWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.SetpointChangeAmount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat SetpointChangeAmount read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatSetpointChangeAmount : public SubscribeAttribute { public: SubscribeAttributeThermostatSetpointChangeAmount() : SubscribeAttribute("setpoint-change-amount") { } ~SubscribeAttributeThermostatSetpointChangeAmount() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::SetpointChangeAmount::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSetpointChangeAmountWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.SetpointChangeAmount response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SetpointChangeSourceTimestamp */ class ReadThermostatSetpointChangeSourceTimestamp : public ReadAttribute { public: ReadThermostatSetpointChangeSourceTimestamp() : ReadAttribute("setpoint-change-source-timestamp") { } ~ReadThermostatSetpointChangeSourceTimestamp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::SetpointChangeSourceTimestamp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSetpointChangeSourceTimestampWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.SetpointChangeSourceTimestamp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat SetpointChangeSourceTimestamp read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatSetpointChangeSourceTimestamp : public SubscribeAttribute { public: SubscribeAttributeThermostatSetpointChangeSourceTimestamp() : SubscribeAttribute("setpoint-change-source-timestamp") { } ~SubscribeAttributeThermostatSetpointChangeSourceTimestamp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::SetpointChangeSourceTimestamp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSetpointChangeSourceTimestampWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.SetpointChangeSourceTimestamp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OccupiedSetback */ class ReadThermostatOccupiedSetback : public ReadAttribute { public: ReadThermostatOccupiedSetback() : ReadAttribute("occupied-setback") { } ~ReadThermostatOccupiedSetback() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::OccupiedSetback::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOccupiedSetbackWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.OccupiedSetback response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat OccupiedSetback read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatOccupiedSetback : public WriteAttribute { public: WriteThermostatOccupiedSetback() : WriteAttribute("occupied-setback") { AddArgument("attr-name", "occupied-setback"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatOccupiedSetback() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::OccupiedSetback::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeOccupiedSetbackWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat OccupiedSetback write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeThermostatOccupiedSetback : public SubscribeAttribute { public: SubscribeAttributeThermostatOccupiedSetback() : SubscribeAttribute("occupied-setback") { } ~SubscribeAttributeThermostatOccupiedSetback() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::OccupiedSetback::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOccupiedSetbackWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.OccupiedSetback response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OccupiedSetbackMin */ class ReadThermostatOccupiedSetbackMin : public ReadAttribute { public: ReadThermostatOccupiedSetbackMin() : ReadAttribute("occupied-setback-min") { } ~ReadThermostatOccupiedSetbackMin() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::OccupiedSetbackMin::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOccupiedSetbackMinWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.OccupiedSetbackMin response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat OccupiedSetbackMin read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatOccupiedSetbackMin : public SubscribeAttribute { public: SubscribeAttributeThermostatOccupiedSetbackMin() : SubscribeAttribute("occupied-setback-min") { } ~SubscribeAttributeThermostatOccupiedSetbackMin() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::OccupiedSetbackMin::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOccupiedSetbackMinWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.OccupiedSetbackMin response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OccupiedSetbackMax */ class ReadThermostatOccupiedSetbackMax : public ReadAttribute { public: ReadThermostatOccupiedSetbackMax() : ReadAttribute("occupied-setback-max") { } ~ReadThermostatOccupiedSetbackMax() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::OccupiedSetbackMax::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOccupiedSetbackMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.OccupiedSetbackMax response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat OccupiedSetbackMax read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatOccupiedSetbackMax : public SubscribeAttribute { public: SubscribeAttributeThermostatOccupiedSetbackMax() : SubscribeAttribute("occupied-setback-max") { } ~SubscribeAttributeThermostatOccupiedSetbackMax() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::OccupiedSetbackMax::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOccupiedSetbackMaxWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.OccupiedSetbackMax response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute UnoccupiedSetback */ class ReadThermostatUnoccupiedSetback : public ReadAttribute { public: ReadThermostatUnoccupiedSetback() : ReadAttribute("unoccupied-setback") { } ~ReadThermostatUnoccupiedSetback() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::UnoccupiedSetback::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUnoccupiedSetbackWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.UnoccupiedSetback response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat UnoccupiedSetback read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatUnoccupiedSetback : public WriteAttribute { public: WriteThermostatUnoccupiedSetback() : WriteAttribute("unoccupied-setback") { AddArgument("attr-name", "unoccupied-setback"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatUnoccupiedSetback() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::UnoccupiedSetback::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeUnoccupiedSetbackWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat UnoccupiedSetback write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeThermostatUnoccupiedSetback : public SubscribeAttribute { public: SubscribeAttributeThermostatUnoccupiedSetback() : SubscribeAttribute("unoccupied-setback") { } ~SubscribeAttributeThermostatUnoccupiedSetback() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::UnoccupiedSetback::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUnoccupiedSetbackWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.UnoccupiedSetback response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute UnoccupiedSetbackMin */ class ReadThermostatUnoccupiedSetbackMin : public ReadAttribute { public: ReadThermostatUnoccupiedSetbackMin() : ReadAttribute("unoccupied-setback-min") { } ~ReadThermostatUnoccupiedSetbackMin() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::UnoccupiedSetbackMin::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUnoccupiedSetbackMinWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.UnoccupiedSetbackMin response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat UnoccupiedSetbackMin read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatUnoccupiedSetbackMin : public SubscribeAttribute { public: SubscribeAttributeThermostatUnoccupiedSetbackMin() : SubscribeAttribute("unoccupied-setback-min") { } ~SubscribeAttributeThermostatUnoccupiedSetbackMin() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::UnoccupiedSetbackMin::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUnoccupiedSetbackMinWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.UnoccupiedSetbackMin response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute UnoccupiedSetbackMax */ class ReadThermostatUnoccupiedSetbackMax : public ReadAttribute { public: ReadThermostatUnoccupiedSetbackMax() : ReadAttribute("unoccupied-setback-max") { } ~ReadThermostatUnoccupiedSetbackMax() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::UnoccupiedSetbackMax::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUnoccupiedSetbackMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.UnoccupiedSetbackMax response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat UnoccupiedSetbackMax read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatUnoccupiedSetbackMax : public SubscribeAttribute { public: SubscribeAttributeThermostatUnoccupiedSetbackMax() : SubscribeAttribute("unoccupied-setback-max") { } ~SubscribeAttributeThermostatUnoccupiedSetbackMax() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::UnoccupiedSetbackMax::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUnoccupiedSetbackMaxWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.UnoccupiedSetbackMax response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute EmergencyHeatDelta */ class ReadThermostatEmergencyHeatDelta : public ReadAttribute { public: ReadThermostatEmergencyHeatDelta() : ReadAttribute("emergency-heat-delta") { } ~ReadThermostatEmergencyHeatDelta() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::EmergencyHeatDelta::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEmergencyHeatDeltaWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.EmergencyHeatDelta response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat EmergencyHeatDelta read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatEmergencyHeatDelta : public WriteAttribute { public: WriteThermostatEmergencyHeatDelta() : WriteAttribute("emergency-heat-delta") { AddArgument("attr-name", "emergency-heat-delta"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatEmergencyHeatDelta() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::EmergencyHeatDelta::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeEmergencyHeatDeltaWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat EmergencyHeatDelta write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeThermostatEmergencyHeatDelta : public SubscribeAttribute { public: SubscribeAttributeThermostatEmergencyHeatDelta() : SubscribeAttribute("emergency-heat-delta") { } ~SubscribeAttributeThermostatEmergencyHeatDelta() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::EmergencyHeatDelta::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEmergencyHeatDeltaWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.EmergencyHeatDelta response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ACType */ class ReadThermostatACType : public ReadAttribute { public: ReadThermostatACType() : ReadAttribute("actype") { } ~ReadThermostatACType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeACTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ACType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat ACType read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatACType : public WriteAttribute { public: WriteThermostatACType() : WriteAttribute("actype") { AddArgument("attr-name", "actype"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatACType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeACTypeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat ACType write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeThermostatACType : public SubscribeAttribute { public: SubscribeAttributeThermostatACType() : SubscribeAttribute("actype") { } ~SubscribeAttributeThermostatACType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ACType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeACTypeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ACType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ACCapacity */ class ReadThermostatACCapacity : public ReadAttribute { public: ReadThermostatACCapacity() : ReadAttribute("accapacity") { } ~ReadThermostatACCapacity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeACCapacityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ACCapacity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat ACCapacity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatACCapacity : public WriteAttribute { public: WriteThermostatACCapacity() : WriteAttribute("accapacity") { AddArgument("attr-name", "accapacity"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatACCapacity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeACCapacityWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat ACCapacity write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeThermostatACCapacity : public SubscribeAttribute { public: SubscribeAttributeThermostatACCapacity() : SubscribeAttribute("accapacity") { } ~SubscribeAttributeThermostatACCapacity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeACCapacityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ACCapacity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ACRefrigerantType */ class ReadThermostatACRefrigerantType : public ReadAttribute { public: ReadThermostatACRefrigerantType() : ReadAttribute("acrefrigerant-type") { } ~ReadThermostatACRefrigerantType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACRefrigerantType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeACRefrigerantTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ACRefrigerantType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat ACRefrigerantType read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatACRefrigerantType : public WriteAttribute { public: WriteThermostatACRefrigerantType() : WriteAttribute("acrefrigerant-type") { AddArgument("attr-name", "acrefrigerant-type"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatACRefrigerantType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACRefrigerantType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeACRefrigerantTypeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat ACRefrigerantType write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeThermostatACRefrigerantType : public SubscribeAttribute { public: SubscribeAttributeThermostatACRefrigerantType() : SubscribeAttribute("acrefrigerant-type") { } ~SubscribeAttributeThermostatACRefrigerantType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ACRefrigerantType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeACRefrigerantTypeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ACRefrigerantType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ACCompressorType */ class ReadThermostatACCompressorType : public ReadAttribute { public: ReadThermostatACCompressorType() : ReadAttribute("accompressor-type") { } ~ReadThermostatACCompressorType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCompressorType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeACCompressorTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ACCompressorType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat ACCompressorType read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatACCompressorType : public WriteAttribute { public: WriteThermostatACCompressorType() : WriteAttribute("accompressor-type") { AddArgument("attr-name", "accompressor-type"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatACCompressorType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCompressorType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeACCompressorTypeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat ACCompressorType write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeThermostatACCompressorType : public SubscribeAttribute { public: SubscribeAttributeThermostatACCompressorType() : SubscribeAttribute("accompressor-type") { } ~SubscribeAttributeThermostatACCompressorType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCompressorType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeACCompressorTypeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ACCompressorType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ACErrorCode */ class ReadThermostatACErrorCode : public ReadAttribute { public: ReadThermostatACErrorCode() : ReadAttribute("acerror-code") { } ~ReadThermostatACErrorCode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACErrorCode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeACErrorCodeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ACErrorCode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat ACErrorCode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatACErrorCode : public WriteAttribute { public: WriteThermostatACErrorCode() : WriteAttribute("acerror-code") { AddArgument("attr-name", "acerror-code"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatACErrorCode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACErrorCode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; [cluster writeAttributeACErrorCodeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat ACErrorCode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint32_t mValue; }; class SubscribeAttributeThermostatACErrorCode : public SubscribeAttribute { public: SubscribeAttributeThermostatACErrorCode() : SubscribeAttribute("acerror-code") { } ~SubscribeAttributeThermostatACErrorCode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ACErrorCode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeACErrorCodeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ACErrorCode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ACLouverPosition */ class ReadThermostatACLouverPosition : public ReadAttribute { public: ReadThermostatACLouverPosition() : ReadAttribute("aclouver-position") { } ~ReadThermostatACLouverPosition() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACLouverPosition::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeACLouverPositionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ACLouverPosition response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat ACLouverPosition read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatACLouverPosition : public WriteAttribute { public: WriteThermostatACLouverPosition() : WriteAttribute("aclouver-position") { AddArgument("attr-name", "aclouver-position"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatACLouverPosition() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACLouverPosition::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeACLouverPositionWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat ACLouverPosition write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeThermostatACLouverPosition : public SubscribeAttribute { public: SubscribeAttributeThermostatACLouverPosition() : SubscribeAttribute("aclouver-position") { } ~SubscribeAttributeThermostatACLouverPosition() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ACLouverPosition::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeACLouverPositionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ACLouverPosition response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ACCoilTemperature */ class ReadThermostatACCoilTemperature : public ReadAttribute { public: ReadThermostatACCoilTemperature() : ReadAttribute("accoil-temperature") { } ~ReadThermostatACCoilTemperature() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCoilTemperature::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeACCoilTemperatureWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ACCoilTemperature response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat ACCoilTemperature read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatACCoilTemperature : public SubscribeAttribute { public: SubscribeAttributeThermostatACCoilTemperature() : SubscribeAttribute("accoil-temperature") { } ~SubscribeAttributeThermostatACCoilTemperature() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCoilTemperature::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeACCoilTemperatureWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ACCoilTemperature response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ACCapacityformat */ class ReadThermostatACCapacityformat : public ReadAttribute { public: ReadThermostatACCapacityformat() : ReadAttribute("accapacityformat") { } ~ReadThermostatACCapacityformat() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacityformat::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeACCapacityformatWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ACCapacityformat response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat ACCapacityformat read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatACCapacityformat : public WriteAttribute { public: WriteThermostatACCapacityformat() : WriteAttribute("accapacityformat") { AddArgument("attr-name", "accapacityformat"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatACCapacityformat() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacityformat::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeACCapacityformatWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat ACCapacityformat write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeThermostatACCapacityformat : public SubscribeAttribute { public: SubscribeAttributeThermostatACCapacityformat() : SubscribeAttribute("accapacityformat") { } ~SubscribeAttributeThermostatACCapacityformat() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ACCapacityformat::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeACCapacityformatWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ACCapacityformat response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute PresetTypes */ class ReadThermostatPresetTypes : public ReadAttribute { public: ReadThermostatPresetTypes() : ReadAttribute("preset-types") { } ~ReadThermostatPresetTypes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::PresetTypes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePresetTypesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.PresetTypes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat PresetTypes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatPresetTypes : public SubscribeAttribute { public: SubscribeAttributeThermostatPresetTypes() : SubscribeAttribute("preset-types") { } ~SubscribeAttributeThermostatPresetTypes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::PresetTypes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePresetTypesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.PresetTypes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ScheduleTypes */ class ReadThermostatScheduleTypes : public ReadAttribute { public: ReadThermostatScheduleTypes() : ReadAttribute("schedule-types") { } ~ReadThermostatScheduleTypes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ScheduleTypes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeScheduleTypesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ScheduleTypes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat ScheduleTypes read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatScheduleTypes : public SubscribeAttribute { public: SubscribeAttributeThermostatScheduleTypes() : SubscribeAttribute("schedule-types") { } ~SubscribeAttributeThermostatScheduleTypes() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ScheduleTypes::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeScheduleTypesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ScheduleTypes response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NumberOfPresets */ class ReadThermostatNumberOfPresets : public ReadAttribute { public: ReadThermostatNumberOfPresets() : ReadAttribute("number-of-presets") { } ~ReadThermostatNumberOfPresets() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::NumberOfPresets::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfPresetsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.NumberOfPresets response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat NumberOfPresets read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatNumberOfPresets : public SubscribeAttribute { public: SubscribeAttributeThermostatNumberOfPresets() : SubscribeAttribute("number-of-presets") { } ~SubscribeAttributeThermostatNumberOfPresets() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::NumberOfPresets::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfPresetsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.NumberOfPresets response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NumberOfSchedules */ class ReadThermostatNumberOfSchedules : public ReadAttribute { public: ReadThermostatNumberOfSchedules() : ReadAttribute("number-of-schedules") { } ~ReadThermostatNumberOfSchedules() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::NumberOfSchedules::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfSchedulesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.NumberOfSchedules response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat NumberOfSchedules read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatNumberOfSchedules : public SubscribeAttribute { public: SubscribeAttributeThermostatNumberOfSchedules() : SubscribeAttribute("number-of-schedules") { } ~SubscribeAttributeThermostatNumberOfSchedules() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::NumberOfSchedules::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfSchedulesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.NumberOfSchedules response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NumberOfScheduleTransitions */ class ReadThermostatNumberOfScheduleTransitions : public ReadAttribute { public: ReadThermostatNumberOfScheduleTransitions() : ReadAttribute("number-of-schedule-transitions") { } ~ReadThermostatNumberOfScheduleTransitions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::NumberOfScheduleTransitions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfScheduleTransitionsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.NumberOfScheduleTransitions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat NumberOfScheduleTransitions read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatNumberOfScheduleTransitions : public SubscribeAttribute { public: SubscribeAttributeThermostatNumberOfScheduleTransitions() : SubscribeAttribute("number-of-schedule-transitions") { } ~SubscribeAttributeThermostatNumberOfScheduleTransitions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::NumberOfScheduleTransitions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfScheduleTransitionsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.NumberOfScheduleTransitions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NumberOfScheduleTransitionPerDay */ class ReadThermostatNumberOfScheduleTransitionPerDay : public ReadAttribute { public: ReadThermostatNumberOfScheduleTransitionPerDay() : ReadAttribute("number-of-schedule-transition-per-day") { } ~ReadThermostatNumberOfScheduleTransitionPerDay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::NumberOfScheduleTransitionPerDay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfScheduleTransitionPerDayWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.NumberOfScheduleTransitionPerDay response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat NumberOfScheduleTransitionPerDay read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatNumberOfScheduleTransitionPerDay : public SubscribeAttribute { public: SubscribeAttributeThermostatNumberOfScheduleTransitionPerDay() : SubscribeAttribute("number-of-schedule-transition-per-day") { } ~SubscribeAttributeThermostatNumberOfScheduleTransitionPerDay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::NumberOfScheduleTransitionPerDay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfScheduleTransitionPerDayWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.NumberOfScheduleTransitionPerDay response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ActivePresetHandle */ class ReadThermostatActivePresetHandle : public ReadAttribute { public: ReadThermostatActivePresetHandle() : ReadAttribute("active-preset-handle") { } ~ReadThermostatActivePresetHandle() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ActivePresetHandle::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActivePresetHandleWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ActivePresetHandle response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat ActivePresetHandle read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatActivePresetHandle : public SubscribeAttribute { public: SubscribeAttributeThermostatActivePresetHandle() : SubscribeAttribute("active-preset-handle") { } ~SubscribeAttributeThermostatActivePresetHandle() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ActivePresetHandle::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActivePresetHandleWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ActivePresetHandle response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ActiveScheduleHandle */ class ReadThermostatActiveScheduleHandle : public ReadAttribute { public: ReadThermostatActiveScheduleHandle() : ReadAttribute("active-schedule-handle") { } ~ReadThermostatActiveScheduleHandle() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ActiveScheduleHandle::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveScheduleHandleWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ActiveScheduleHandle response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat ActiveScheduleHandle read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatActiveScheduleHandle : public SubscribeAttribute { public: SubscribeAttributeThermostatActiveScheduleHandle() : SubscribeAttribute("active-schedule-handle") { } ~SubscribeAttributeThermostatActiveScheduleHandle() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ActiveScheduleHandle::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveScheduleHandleWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ActiveScheduleHandle response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Presets */ class ReadThermostatPresets : public ReadAttribute { public: ReadThermostatPresets() : ReadAttribute("presets") { } ~ReadThermostatPresets() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::Presets::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePresetsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.Presets response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat Presets read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatPresets : public WriteAttribute { public: WriteThermostatPresets() : WriteAttribute("presets") , mComplex(&mValue) { AddArgument("attr-name", "presets"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteThermostatPresets() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::Presets::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSArray * _Nonnull value; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { MTRThermostatClusterPresetStruct * newElement_0; newElement_0 = [MTRThermostatClusterPresetStruct new]; if (entry_0.presetHandle.IsNull()) { newElement_0.presetHandle = nil; } else { newElement_0.presetHandle = [NSData dataWithBytes:entry_0.presetHandle.Value().data() length:entry_0.presetHandle.Value().size()]; } newElement_0.presetScenario = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.presetScenario)]; if (entry_0.name.HasValue()) { if (entry_0.name.Value().IsNull()) { newElement_0.name = nil; } else { newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.Value().Value().data() length:entry_0.name.Value().Value().size() encoding:NSUTF8StringEncoding]; } } else { newElement_0.name = nil; } if (entry_0.coolingSetpoint.HasValue()) { newElement_0.coolingSetpoint = [NSNumber numberWithShort:entry_0.coolingSetpoint.Value()]; } else { newElement_0.coolingSetpoint = nil; } if (entry_0.heatingSetpoint.HasValue()) { newElement_0.heatingSetpoint = [NSNumber numberWithShort:entry_0.heatingSetpoint.Value()]; } else { newElement_0.heatingSetpoint = nil; } if (entry_0.builtIn.IsNull()) { newElement_0.builtIn = nil; } else { newElement_0.builtIn = [NSNumber numberWithBool:entry_0.builtIn.Value()]; } [array_0 addObject:newElement_0]; } value = array_0; } [cluster writeAttributePresetsWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat Presets write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::List mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeThermostatPresets : public SubscribeAttribute { public: SubscribeAttributeThermostatPresets() : SubscribeAttribute("presets") { } ~SubscribeAttributeThermostatPresets() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::Presets::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePresetsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.Presets response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Schedules */ class ReadThermostatSchedules : public ReadAttribute { public: ReadThermostatSchedules() : ReadAttribute("schedules") { } ~ReadThermostatSchedules() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::Schedules::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSchedulesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.Schedules response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat Schedules read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatSchedules : public WriteAttribute { public: WriteThermostatSchedules() : WriteAttribute("schedules") , mComplex(&mValue) { AddArgument("attr-name", "schedules"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteThermostatSchedules() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::Schedules::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSArray * _Nonnull value; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { MTRThermostatClusterScheduleStruct * newElement_0; newElement_0 = [MTRThermostatClusterScheduleStruct new]; if (entry_0.scheduleHandle.IsNull()) { newElement_0.scheduleHandle = nil; } else { newElement_0.scheduleHandle = [NSData dataWithBytes:entry_0.scheduleHandle.Value().data() length:entry_0.scheduleHandle.Value().size()]; } newElement_0.systemMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.systemMode)]; if (entry_0.name.HasValue()) { newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.Value().data() length:entry_0.name.Value().size() encoding:NSUTF8StringEncoding]; } else { newElement_0.name = nil; } if (entry_0.presetHandle.HasValue()) { newElement_0.presetHandle = [NSData dataWithBytes:entry_0.presetHandle.Value().data() length:entry_0.presetHandle.Value().size()]; } else { newElement_0.presetHandle = nil; } { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.transitions) { MTRThermostatClusterScheduleTransitionStruct * newElement_2; newElement_2 = [MTRThermostatClusterScheduleTransitionStruct new]; newElement_2.dayOfWeek = [NSNumber numberWithUnsignedChar:entry_2.dayOfWeek.Raw()]; newElement_2.transitionTime = [NSNumber numberWithUnsignedShort:entry_2.transitionTime]; if (entry_2.presetHandle.HasValue()) { newElement_2.presetHandle = [NSData dataWithBytes:entry_2.presetHandle.Value().data() length:entry_2.presetHandle.Value().size()]; } else { newElement_2.presetHandle = nil; } if (entry_2.systemMode.HasValue()) { newElement_2.systemMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.systemMode.Value())]; } else { newElement_2.systemMode = nil; } if (entry_2.coolingSetpoint.HasValue()) { newElement_2.coolingSetpoint = [NSNumber numberWithShort:entry_2.coolingSetpoint.Value()]; } else { newElement_2.coolingSetpoint = nil; } if (entry_2.heatingSetpoint.HasValue()) { newElement_2.heatingSetpoint = [NSNumber numberWithShort:entry_2.heatingSetpoint.Value()]; } else { newElement_2.heatingSetpoint = nil; } [array_2 addObject:newElement_2]; } newElement_0.transitions = array_2; } if (entry_0.builtIn.IsNull()) { newElement_0.builtIn = nil; } else { newElement_0.builtIn = [NSNumber numberWithBool:entry_0.builtIn.Value()]; } [array_0 addObject:newElement_0]; } value = array_0; } [cluster writeAttributeSchedulesWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Thermostat Schedules write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::List mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeThermostatSchedules : public SubscribeAttribute { public: SubscribeAttributeThermostatSchedules() : SubscribeAttribute("schedules") { } ~SubscribeAttributeThermostatSchedules() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::Schedules::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSchedulesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.Schedules response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SetpointHoldExpiryTimestamp */ class ReadThermostatSetpointHoldExpiryTimestamp : public ReadAttribute { public: ReadThermostatSetpointHoldExpiryTimestamp() : ReadAttribute("setpoint-hold-expiry-timestamp") { } ~ReadThermostatSetpointHoldExpiryTimestamp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::SetpointHoldExpiryTimestamp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSetpointHoldExpiryTimestampWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.SetpointHoldExpiryTimestamp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat SetpointHoldExpiryTimestamp read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatSetpointHoldExpiryTimestamp : public SubscribeAttribute { public: SubscribeAttributeThermostatSetpointHoldExpiryTimestamp() : SubscribeAttribute("setpoint-hold-expiry-timestamp") { } ~SubscribeAttributeThermostatSetpointHoldExpiryTimestamp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::SetpointHoldExpiryTimestamp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSetpointHoldExpiryTimestampWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.SetpointHoldExpiryTimestamp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadThermostatGeneratedCommandList : public ReadAttribute { public: ReadThermostatGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadThermostatGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeThermostatGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeThermostatGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadThermostatAcceptedCommandList : public ReadAttribute { public: ReadThermostatAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadThermostatAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeThermostatAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeThermostatAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadThermostatEventList : public ReadAttribute { public: ReadThermostatEventList() : ReadAttribute("event-list") { } ~ReadThermostatEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatEventList : public SubscribeAttribute { public: SubscribeAttributeThermostatEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeThermostatEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadThermostatAttributeList : public ReadAttribute { public: ReadThermostatAttributeList() : ReadAttribute("attribute-list") { } ~ReadThermostatAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatAttributeList : public SubscribeAttribute { public: SubscribeAttributeThermostatAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeThermostatAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadThermostatFeatureMap : public ReadAttribute { public: ReadThermostatFeatureMap() : ReadAttribute("feature-map") { } ~ReadThermostatFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatFeatureMap : public SubscribeAttribute { public: SubscribeAttributeThermostatFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeThermostatFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadThermostatClusterRevision : public ReadAttribute { public: ReadThermostatClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadThermostatClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Thermostat::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Thermostat ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatClusterRevision : public SubscribeAttribute { public: SubscribeAttributeThermostatClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeThermostatClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Thermostat::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Thermostat::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster FanControl | 0x0202 | |------------------------------------------------------------------------------| | Commands: | | | * Step | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * FanMode | 0x0000 | | * FanModeSequence | 0x0001 | | * PercentSetting | 0x0002 | | * PercentCurrent | 0x0003 | | * SpeedMax | 0x0004 | | * SpeedSetting | 0x0005 | | * SpeedCurrent | 0x0006 | | * RockSupport | 0x0007 | | * RockSetting | 0x0008 | | * WindSupport | 0x0009 | | * WindSetting | 0x000A | | * AirflowDirection | 0x000B | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command Step */ class FanControlStep : public ClusterCommand { public: FanControlStep() : ClusterCommand("step") { AddArgument("Direction", 0, UINT8_MAX, &mRequest.direction); AddArgument("Wrap", 0, 1, &mRequest.wrap); AddArgument("LowestOff", 0, 1, &mRequest.lowestOff); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::FanControl::Commands::Step::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRFanControlClusterStepParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.direction = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.direction)]; if (mRequest.wrap.HasValue()) { params.wrap = [NSNumber numberWithBool:mRequest.wrap.Value()]; } else { params.wrap = nil; } if (mRequest.lowestOff.HasValue()) { params.lowestOff = [NSNumber numberWithBool:mRequest.lowestOff.Value()]; } else { params.lowestOff = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stepWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::FanControl::Commands::Step::Type mRequest; }; /* * Attribute FanMode */ class ReadFanControlFanMode : public ReadAttribute { public: ReadFanControlFanMode() : ReadAttribute("fan-mode") { } ~ReadFanControlFanMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::FanMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFanModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.FanMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl FanMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteFanControlFanMode : public WriteAttribute { public: WriteFanControlFanMode() : WriteAttribute("fan-mode") { AddArgument("attr-name", "fan-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteFanControlFanMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::FanMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeFanModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("FanControl FanMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeFanControlFanMode : public SubscribeAttribute { public: SubscribeAttributeFanControlFanMode() : SubscribeAttribute("fan-mode") { } ~SubscribeAttributeFanControlFanMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::FanMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFanModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.FanMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FanModeSequence */ class ReadFanControlFanModeSequence : public ReadAttribute { public: ReadFanControlFanModeSequence() : ReadAttribute("fan-mode-sequence") { } ~ReadFanControlFanModeSequence() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::FanModeSequence::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFanModeSequenceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.FanModeSequence response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl FanModeSequence read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFanControlFanModeSequence : public SubscribeAttribute { public: SubscribeAttributeFanControlFanModeSequence() : SubscribeAttribute("fan-mode-sequence") { } ~SubscribeAttributeFanControlFanModeSequence() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::FanModeSequence::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFanModeSequenceWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.FanModeSequence response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PercentSetting */ class ReadFanControlPercentSetting : public ReadAttribute { public: ReadFanControlPercentSetting() : ReadAttribute("percent-setting") { } ~ReadFanControlPercentSetting() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::PercentSetting::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePercentSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.PercentSetting response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl PercentSetting read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteFanControlPercentSetting : public WriteAttribute { public: WriteFanControlPercentSetting() : WriteAttribute("percent-setting") { AddArgument("attr-name", "percent-setting"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteFanControlPercentSetting() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::PercentSetting::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributePercentSettingWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("FanControl PercentSetting write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeFanControlPercentSetting : public SubscribeAttribute { public: SubscribeAttributeFanControlPercentSetting() : SubscribeAttribute("percent-setting") { } ~SubscribeAttributeFanControlPercentSetting() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::PercentSetting::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePercentSettingWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.PercentSetting response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PercentCurrent */ class ReadFanControlPercentCurrent : public ReadAttribute { public: ReadFanControlPercentCurrent() : ReadAttribute("percent-current") { } ~ReadFanControlPercentCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::PercentCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePercentCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.PercentCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl PercentCurrent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFanControlPercentCurrent : public SubscribeAttribute { public: SubscribeAttributeFanControlPercentCurrent() : SubscribeAttribute("percent-current") { } ~SubscribeAttributeFanControlPercentCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::PercentCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePercentCurrentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.PercentCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SpeedMax */ class ReadFanControlSpeedMax : public ReadAttribute { public: ReadFanControlSpeedMax() : ReadAttribute("speed-max") { } ~ReadFanControlSpeedMax() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::SpeedMax::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSpeedMaxWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.SpeedMax response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl SpeedMax read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFanControlSpeedMax : public SubscribeAttribute { public: SubscribeAttributeFanControlSpeedMax() : SubscribeAttribute("speed-max") { } ~SubscribeAttributeFanControlSpeedMax() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::SpeedMax::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSpeedMaxWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.SpeedMax response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SpeedSetting */ class ReadFanControlSpeedSetting : public ReadAttribute { public: ReadFanControlSpeedSetting() : ReadAttribute("speed-setting") { } ~ReadFanControlSpeedSetting() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::SpeedSetting::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSpeedSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.SpeedSetting response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl SpeedSetting read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteFanControlSpeedSetting : public WriteAttribute { public: WriteFanControlSpeedSetting() : WriteAttribute("speed-setting") { AddArgument("attr-name", "speed-setting"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteFanControlSpeedSetting() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::SpeedSetting::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeSpeedSettingWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("FanControl SpeedSetting write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeFanControlSpeedSetting : public SubscribeAttribute { public: SubscribeAttributeFanControlSpeedSetting() : SubscribeAttribute("speed-setting") { } ~SubscribeAttributeFanControlSpeedSetting() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::SpeedSetting::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSpeedSettingWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.SpeedSetting response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SpeedCurrent */ class ReadFanControlSpeedCurrent : public ReadAttribute { public: ReadFanControlSpeedCurrent() : ReadAttribute("speed-current") { } ~ReadFanControlSpeedCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::SpeedCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSpeedCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.SpeedCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl SpeedCurrent read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFanControlSpeedCurrent : public SubscribeAttribute { public: SubscribeAttributeFanControlSpeedCurrent() : SubscribeAttribute("speed-current") { } ~SubscribeAttributeFanControlSpeedCurrent() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::SpeedCurrent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSpeedCurrentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.SpeedCurrent response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RockSupport */ class ReadFanControlRockSupport : public ReadAttribute { public: ReadFanControlRockSupport() : ReadAttribute("rock-support") { } ~ReadFanControlRockSupport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::RockSupport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRockSupportWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.RockSupport response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl RockSupport read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFanControlRockSupport : public SubscribeAttribute { public: SubscribeAttributeFanControlRockSupport() : SubscribeAttribute("rock-support") { } ~SubscribeAttributeFanControlRockSupport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::RockSupport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRockSupportWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.RockSupport response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RockSetting */ class ReadFanControlRockSetting : public ReadAttribute { public: ReadFanControlRockSetting() : ReadAttribute("rock-setting") { } ~ReadFanControlRockSetting() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::RockSetting::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRockSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.RockSetting response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl RockSetting read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteFanControlRockSetting : public WriteAttribute { public: WriteFanControlRockSetting() : WriteAttribute("rock-setting") { AddArgument("attr-name", "rock-setting"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteFanControlRockSetting() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::RockSetting::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeRockSettingWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("FanControl RockSetting write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeFanControlRockSetting : public SubscribeAttribute { public: SubscribeAttributeFanControlRockSetting() : SubscribeAttribute("rock-setting") { } ~SubscribeAttributeFanControlRockSetting() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::RockSetting::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRockSettingWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.RockSetting response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute WindSupport */ class ReadFanControlWindSupport : public ReadAttribute { public: ReadFanControlWindSupport() : ReadAttribute("wind-support") { } ~ReadFanControlWindSupport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::WindSupport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWindSupportWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.WindSupport response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl WindSupport read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFanControlWindSupport : public SubscribeAttribute { public: SubscribeAttributeFanControlWindSupport() : SubscribeAttribute("wind-support") { } ~SubscribeAttributeFanControlWindSupport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::WindSupport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWindSupportWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.WindSupport response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute WindSetting */ class ReadFanControlWindSetting : public ReadAttribute { public: ReadFanControlWindSetting() : ReadAttribute("wind-setting") { } ~ReadFanControlWindSetting() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::WindSetting::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWindSettingWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.WindSetting response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl WindSetting read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteFanControlWindSetting : public WriteAttribute { public: WriteFanControlWindSetting() : WriteAttribute("wind-setting") { AddArgument("attr-name", "wind-setting"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteFanControlWindSetting() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::WindSetting::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeWindSettingWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("FanControl WindSetting write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeFanControlWindSetting : public SubscribeAttribute { public: SubscribeAttributeFanControlWindSetting() : SubscribeAttribute("wind-setting") { } ~SubscribeAttributeFanControlWindSetting() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::WindSetting::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWindSettingWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.WindSetting response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AirflowDirection */ class ReadFanControlAirflowDirection : public ReadAttribute { public: ReadFanControlAirflowDirection() : ReadAttribute("airflow-direction") { } ~ReadFanControlAirflowDirection() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::AirflowDirection::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAirflowDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.AirflowDirection response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl AirflowDirection read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteFanControlAirflowDirection : public WriteAttribute { public: WriteFanControlAirflowDirection() : WriteAttribute("airflow-direction") { AddArgument("attr-name", "airflow-direction"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteFanControlAirflowDirection() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::AirflowDirection::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeAirflowDirectionWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("FanControl AirflowDirection write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeFanControlAirflowDirection : public SubscribeAttribute { public: SubscribeAttributeFanControlAirflowDirection() : SubscribeAttribute("airflow-direction") { } ~SubscribeAttributeFanControlAirflowDirection() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::AirflowDirection::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAirflowDirectionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.AirflowDirection response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadFanControlGeneratedCommandList : public ReadAttribute { public: ReadFanControlGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadFanControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFanControlGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeFanControlGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeFanControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadFanControlAcceptedCommandList : public ReadAttribute { public: ReadFanControlAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadFanControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFanControlAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeFanControlAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeFanControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadFanControlEventList : public ReadAttribute { public: ReadFanControlEventList() : ReadAttribute("event-list") { } ~ReadFanControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFanControlEventList : public SubscribeAttribute { public: SubscribeAttributeFanControlEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeFanControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadFanControlAttributeList : public ReadAttribute { public: ReadFanControlAttributeList() : ReadAttribute("attribute-list") { } ~ReadFanControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFanControlAttributeList : public SubscribeAttribute { public: SubscribeAttributeFanControlAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeFanControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadFanControlFeatureMap : public ReadAttribute { public: ReadFanControlFeatureMap() : ReadAttribute("feature-map") { } ~ReadFanControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFanControlFeatureMap : public SubscribeAttribute { public: SubscribeAttributeFanControlFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeFanControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadFanControlClusterRevision : public ReadAttribute { public: ReadFanControlClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadFanControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FanControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FanControl ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFanControlClusterRevision : public SubscribeAttribute { public: SubscribeAttributeFanControlClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeFanControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FanControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FanControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster ThermostatUserInterfaceConfiguration | 0x0204 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * TemperatureDisplayMode | 0x0000 | | * KeypadLockout | 0x0001 | | * ScheduleProgrammingVisibility | 0x0002 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute TemperatureDisplayMode */ class ReadThermostatUserInterfaceConfigurationTemperatureDisplayMode : public ReadAttribute { public: ReadThermostatUserInterfaceConfigurationTemperatureDisplayMode() : ReadAttribute("temperature-display-mode") { } ~ReadThermostatUserInterfaceConfigurationTemperatureDisplayMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTemperatureDisplayModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.TemperatureDisplayMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThermostatUserInterfaceConfiguration TemperatureDisplayMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatUserInterfaceConfigurationTemperatureDisplayMode : public WriteAttribute { public: WriteThermostatUserInterfaceConfigurationTemperatureDisplayMode() : WriteAttribute("temperature-display-mode") { AddArgument("attr-name", "temperature-display-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatUserInterfaceConfigurationTemperatureDisplayMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeTemperatureDisplayModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ThermostatUserInterfaceConfiguration TemperatureDisplayMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeThermostatUserInterfaceConfigurationTemperatureDisplayMode : public SubscribeAttribute { public: SubscribeAttributeThermostatUserInterfaceConfigurationTemperatureDisplayMode() : SubscribeAttribute("temperature-display-mode") { } ~SubscribeAttributeThermostatUserInterfaceConfigurationTemperatureDisplayMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTemperatureDisplayModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.TemperatureDisplayMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute KeypadLockout */ class ReadThermostatUserInterfaceConfigurationKeypadLockout : public ReadAttribute { public: ReadThermostatUserInterfaceConfigurationKeypadLockout() : ReadAttribute("keypad-lockout") { } ~ReadThermostatUserInterfaceConfigurationKeypadLockout() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeKeypadLockoutWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.KeypadLockout response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThermostatUserInterfaceConfiguration KeypadLockout read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatUserInterfaceConfigurationKeypadLockout : public WriteAttribute { public: WriteThermostatUserInterfaceConfigurationKeypadLockout() : WriteAttribute("keypad-lockout") { AddArgument("attr-name", "keypad-lockout"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatUserInterfaceConfigurationKeypadLockout() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeKeypadLockoutWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ThermostatUserInterfaceConfiguration KeypadLockout write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeThermostatUserInterfaceConfigurationKeypadLockout : public SubscribeAttribute { public: SubscribeAttributeThermostatUserInterfaceConfigurationKeypadLockout() : SubscribeAttribute("keypad-lockout") { } ~SubscribeAttributeThermostatUserInterfaceConfigurationKeypadLockout() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeKeypadLockoutWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.KeypadLockout response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ScheduleProgrammingVisibility */ class ReadThermostatUserInterfaceConfigurationScheduleProgrammingVisibility : public ReadAttribute { public: ReadThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() : ReadAttribute("schedule-programming-visibility") { } ~ReadThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeScheduleProgrammingVisibilityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThermostatUserInterfaceConfiguration ScheduleProgrammingVisibility read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThermostatUserInterfaceConfigurationScheduleProgrammingVisibility : public WriteAttribute { public: WriteThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() : WriteAttribute("schedule-programming-visibility") { AddArgument("attr-name", "schedule-programming-visibility"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeScheduleProgrammingVisibilityWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ThermostatUserInterfaceConfiguration ScheduleProgrammingVisibility write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeThermostatUserInterfaceConfigurationScheduleProgrammingVisibility : public SubscribeAttribute { public: SubscribeAttributeThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() : SubscribeAttribute("schedule-programming-visibility") { } ~SubscribeAttributeThermostatUserInterfaceConfigurationScheduleProgrammingVisibility() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeScheduleProgrammingVisibilityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadThermostatUserInterfaceConfigurationGeneratedCommandList : public ReadAttribute { public: ReadThermostatUserInterfaceConfigurationGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadThermostatUserInterfaceConfigurationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThermostatUserInterfaceConfiguration GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatUserInterfaceConfigurationGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeThermostatUserInterfaceConfigurationGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeThermostatUserInterfaceConfigurationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadThermostatUserInterfaceConfigurationAcceptedCommandList : public ReadAttribute { public: ReadThermostatUserInterfaceConfigurationAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadThermostatUserInterfaceConfigurationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThermostatUserInterfaceConfiguration AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatUserInterfaceConfigurationAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeThermostatUserInterfaceConfigurationAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeThermostatUserInterfaceConfigurationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadThermostatUserInterfaceConfigurationEventList : public ReadAttribute { public: ReadThermostatUserInterfaceConfigurationEventList() : ReadAttribute("event-list") { } ~ReadThermostatUserInterfaceConfigurationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThermostatUserInterfaceConfiguration EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatUserInterfaceConfigurationEventList : public SubscribeAttribute { public: SubscribeAttributeThermostatUserInterfaceConfigurationEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeThermostatUserInterfaceConfigurationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadThermostatUserInterfaceConfigurationAttributeList : public ReadAttribute { public: ReadThermostatUserInterfaceConfigurationAttributeList() : ReadAttribute("attribute-list") { } ~ReadThermostatUserInterfaceConfigurationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThermostatUserInterfaceConfiguration AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatUserInterfaceConfigurationAttributeList : public SubscribeAttribute { public: SubscribeAttributeThermostatUserInterfaceConfigurationAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeThermostatUserInterfaceConfigurationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadThermostatUserInterfaceConfigurationFeatureMap : public ReadAttribute { public: ReadThermostatUserInterfaceConfigurationFeatureMap() : ReadAttribute("feature-map") { } ~ReadThermostatUserInterfaceConfigurationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThermostatUserInterfaceConfiguration FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatUserInterfaceConfigurationFeatureMap : public SubscribeAttribute { public: SubscribeAttributeThermostatUserInterfaceConfigurationFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeThermostatUserInterfaceConfigurationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadThermostatUserInterfaceConfigurationClusterRevision : public ReadAttribute { public: ReadThermostatUserInterfaceConfigurationClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadThermostatUserInterfaceConfigurationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThermostatUserInterfaceConfiguration ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThermostatUserInterfaceConfigurationClusterRevision : public SubscribeAttribute { public: SubscribeAttributeThermostatUserInterfaceConfigurationClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeThermostatUserInterfaceConfigurationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster ColorControl | 0x0300 | |------------------------------------------------------------------------------| | Commands: | | | * MoveToHue | 0x00 | | * MoveHue | 0x01 | | * StepHue | 0x02 | | * MoveToSaturation | 0x03 | | * MoveSaturation | 0x04 | | * StepSaturation | 0x05 | | * MoveToHueAndSaturation | 0x06 | | * MoveToColor | 0x07 | | * MoveColor | 0x08 | | * StepColor | 0x09 | | * MoveToColorTemperature | 0x0A | | * EnhancedMoveToHue | 0x40 | | * EnhancedMoveHue | 0x41 | | * EnhancedStepHue | 0x42 | | * EnhancedMoveToHueAndSaturation | 0x43 | | * ColorLoopSet | 0x44 | | * StopMoveStep | 0x47 | | * MoveColorTemperature | 0x4B | | * StepColorTemperature | 0x4C | |------------------------------------------------------------------------------| | Attributes: | | | * CurrentHue | 0x0000 | | * CurrentSaturation | 0x0001 | | * RemainingTime | 0x0002 | | * CurrentX | 0x0003 | | * CurrentY | 0x0004 | | * DriftCompensation | 0x0005 | | * CompensationText | 0x0006 | | * ColorTemperatureMireds | 0x0007 | | * ColorMode | 0x0008 | | * Options | 0x000F | | * NumberOfPrimaries | 0x0010 | | * Primary1X | 0x0011 | | * Primary1Y | 0x0012 | | * Primary1Intensity | 0x0013 | | * Primary2X | 0x0015 | | * Primary2Y | 0x0016 | | * Primary2Intensity | 0x0017 | | * Primary3X | 0x0019 | | * Primary3Y | 0x001A | | * Primary3Intensity | 0x001B | | * Primary4X | 0x0020 | | * Primary4Y | 0x0021 | | * Primary4Intensity | 0x0022 | | * Primary5X | 0x0024 | | * Primary5Y | 0x0025 | | * Primary5Intensity | 0x0026 | | * Primary6X | 0x0028 | | * Primary6Y | 0x0029 | | * Primary6Intensity | 0x002A | | * WhitePointX | 0x0030 | | * WhitePointY | 0x0031 | | * ColorPointRX | 0x0032 | | * ColorPointRY | 0x0033 | | * ColorPointRIntensity | 0x0034 | | * ColorPointGX | 0x0036 | | * ColorPointGY | 0x0037 | | * ColorPointGIntensity | 0x0038 | | * ColorPointBX | 0x003A | | * ColorPointBY | 0x003B | | * ColorPointBIntensity | 0x003C | | * EnhancedCurrentHue | 0x4000 | | * EnhancedColorMode | 0x4001 | | * ColorLoopActive | 0x4002 | | * ColorLoopDirection | 0x4003 | | * ColorLoopTime | 0x4004 | | * ColorLoopStartEnhancedHue | 0x4005 | | * ColorLoopStoredEnhancedHue | 0x4006 | | * ColorCapabilities | 0x400A | | * ColorTempPhysicalMinMireds | 0x400B | | * ColorTempPhysicalMaxMireds | 0x400C | | * CoupleColorTempToLevelMinMireds | 0x400D | | * StartUpColorTemperatureMireds | 0x4010 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command MoveToHue */ class ColorControlMoveToHue : public ClusterCommand { public: ColorControlMoveToHue() : ClusterCommand("move-to-hue") { AddArgument("Hue", 0, UINT8_MAX, &mRequest.hue); AddArgument("Direction", 0, UINT8_MAX, &mRequest.direction); AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::MoveToHue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterMoveToHueParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.hue = [NSNumber numberWithUnsignedChar:mRequest.hue]; params.direction = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.direction)]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster moveToHueWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::MoveToHue::Type mRequest; }; /* * Command MoveHue */ class ColorControlMoveHue : public ClusterCommand { public: ColorControlMoveHue() : ClusterCommand("move-hue") { AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); AddArgument("Rate", 0, UINT8_MAX, &mRequest.rate); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::MoveHue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterMoveHueParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.moveMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; params.rate = [NSNumber numberWithUnsignedChar:mRequest.rate]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster moveHueWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::MoveHue::Type mRequest; }; /* * Command StepHue */ class ColorControlStepHue : public ClusterCommand { public: ColorControlStepHue() : ClusterCommand("step-hue") { AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); AddArgument("StepSize", 0, UINT8_MAX, &mRequest.stepSize); AddArgument("TransitionTime", 0, UINT8_MAX, &mRequest.transitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::StepHue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterStepHueParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.stepMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; params.stepSize = [NSNumber numberWithUnsignedChar:mRequest.stepSize]; params.transitionTime = [NSNumber numberWithUnsignedChar:mRequest.transitionTime]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stepHueWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::StepHue::Type mRequest; }; /* * Command MoveToSaturation */ class ColorControlMoveToSaturation : public ClusterCommand { public: ColorControlMoveToSaturation() : ClusterCommand("move-to-saturation") { AddArgument("Saturation", 0, UINT8_MAX, &mRequest.saturation); AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterMoveToSaturationParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.saturation = [NSNumber numberWithUnsignedChar:mRequest.saturation]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster moveToSaturationWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type mRequest; }; /* * Command MoveSaturation */ class ColorControlMoveSaturation : public ClusterCommand { public: ColorControlMoveSaturation() : ClusterCommand("move-saturation") { AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); AddArgument("Rate", 0, UINT8_MAX, &mRequest.rate); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::MoveSaturation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterMoveSaturationParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.moveMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; params.rate = [NSNumber numberWithUnsignedChar:mRequest.rate]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster moveSaturationWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type mRequest; }; /* * Command StepSaturation */ class ColorControlStepSaturation : public ClusterCommand { public: ColorControlStepSaturation() : ClusterCommand("step-saturation") { AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); AddArgument("StepSize", 0, UINT8_MAX, &mRequest.stepSize); AddArgument("TransitionTime", 0, UINT8_MAX, &mRequest.transitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::StepSaturation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterStepSaturationParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.stepMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; params.stepSize = [NSNumber numberWithUnsignedChar:mRequest.stepSize]; params.transitionTime = [NSNumber numberWithUnsignedChar:mRequest.transitionTime]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stepSaturationWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::StepSaturation::Type mRequest; }; /* * Command MoveToHueAndSaturation */ class ColorControlMoveToHueAndSaturation : public ClusterCommand { public: ColorControlMoveToHueAndSaturation() : ClusterCommand("move-to-hue-and-saturation") { AddArgument("Hue", 0, UINT8_MAX, &mRequest.hue); AddArgument("Saturation", 0, UINT8_MAX, &mRequest.saturation); AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::MoveToHueAndSaturation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterMoveToHueAndSaturationParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.hue = [NSNumber numberWithUnsignedChar:mRequest.hue]; params.saturation = [NSNumber numberWithUnsignedChar:mRequest.saturation]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster moveToHueAndSaturationWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::MoveToHueAndSaturation::Type mRequest; }; /* * Command MoveToColor */ class ColorControlMoveToColor : public ClusterCommand { public: ColorControlMoveToColor() : ClusterCommand("move-to-color") { AddArgument("ColorX", 0, UINT16_MAX, &mRequest.colorX); AddArgument("ColorY", 0, UINT16_MAX, &mRequest.colorY); AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::MoveToColor::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterMoveToColorParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.colorX = [NSNumber numberWithUnsignedShort:mRequest.colorX]; params.colorY = [NSNumber numberWithUnsignedShort:mRequest.colorY]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster moveToColorWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::MoveToColor::Type mRequest; }; /* * Command MoveColor */ class ColorControlMoveColor : public ClusterCommand { public: ColorControlMoveColor() : ClusterCommand("move-color") { AddArgument("RateX", INT16_MIN, INT16_MAX, &mRequest.rateX); AddArgument("RateY", INT16_MIN, INT16_MAX, &mRequest.rateY); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::MoveColor::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterMoveColorParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.rateX = [NSNumber numberWithShort:mRequest.rateX]; params.rateY = [NSNumber numberWithShort:mRequest.rateY]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster moveColorWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::MoveColor::Type mRequest; }; /* * Command StepColor */ class ColorControlStepColor : public ClusterCommand { public: ColorControlStepColor() : ClusterCommand("step-color") { AddArgument("StepX", INT16_MIN, INT16_MAX, &mRequest.stepX); AddArgument("StepY", INT16_MIN, INT16_MAX, &mRequest.stepY); AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::StepColor::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterStepColorParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.stepX = [NSNumber numberWithShort:mRequest.stepX]; params.stepY = [NSNumber numberWithShort:mRequest.stepY]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stepColorWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::StepColor::Type mRequest; }; /* * Command MoveToColorTemperature */ class ColorControlMoveToColorTemperature : public ClusterCommand { public: ColorControlMoveToColorTemperature() : ClusterCommand("move-to-color-temperature") { AddArgument("ColorTemperatureMireds", 0, UINT16_MAX, &mRequest.colorTemperatureMireds); AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::MoveToColorTemperature::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterMoveToColorTemperatureParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.colorTemperatureMireds = [NSNumber numberWithUnsignedShort:mRequest.colorTemperatureMireds]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster moveToColorTemperatureWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::MoveToColorTemperature::Type mRequest; }; /* * Command EnhancedMoveToHue */ class ColorControlEnhancedMoveToHue : public ClusterCommand { public: ColorControlEnhancedMoveToHue() : ClusterCommand("enhanced-move-to-hue") { AddArgument("EnhancedHue", 0, UINT16_MAX, &mRequest.enhancedHue); AddArgument("Direction", 0, UINT8_MAX, &mRequest.direction); AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterEnhancedMoveToHueParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.enhancedHue = [NSNumber numberWithUnsignedShort:mRequest.enhancedHue]; params.direction = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.direction)]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster enhancedMoveToHueWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHue::Type mRequest; }; /* * Command EnhancedMoveHue */ class ColorControlEnhancedMoveHue : public ClusterCommand { public: ColorControlEnhancedMoveHue() : ClusterCommand("enhanced-move-hue") { AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); AddArgument("Rate", 0, UINT16_MAX, &mRequest.rate); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterEnhancedMoveHueParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.moveMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; params.rate = [NSNumber numberWithUnsignedShort:mRequest.rate]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster enhancedMoveHueWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::EnhancedMoveHue::Type mRequest; }; /* * Command EnhancedStepHue */ class ColorControlEnhancedStepHue : public ClusterCommand { public: ColorControlEnhancedStepHue() : ClusterCommand("enhanced-step-hue") { AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); AddArgument("StepSize", 0, UINT16_MAX, &mRequest.stepSize); AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::EnhancedStepHue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterEnhancedStepHueParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.stepMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; params.stepSize = [NSNumber numberWithUnsignedShort:mRequest.stepSize]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster enhancedStepHueWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::EnhancedStepHue::Type mRequest; }; /* * Command EnhancedMoveToHueAndSaturation */ class ColorControlEnhancedMoveToHueAndSaturation : public ClusterCommand { public: ColorControlEnhancedMoveToHueAndSaturation() : ClusterCommand("enhanced-move-to-hue-and-saturation") { AddArgument("EnhancedHue", 0, UINT16_MAX, &mRequest.enhancedHue); AddArgument("Saturation", 0, UINT8_MAX, &mRequest.saturation); AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHueAndSaturation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterEnhancedMoveToHueAndSaturationParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.enhancedHue = [NSNumber numberWithUnsignedShort:mRequest.enhancedHue]; params.saturation = [NSNumber numberWithUnsignedChar:mRequest.saturation]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster enhancedMoveToHueAndSaturationWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::EnhancedMoveToHueAndSaturation::Type mRequest; }; /* * Command ColorLoopSet */ class ColorControlColorLoopSet : public ClusterCommand { public: ColorControlColorLoopSet() : ClusterCommand("color-loop-set") { AddArgument("UpdateFlags", 0, UINT8_MAX, &mRequest.updateFlags); AddArgument("Action", 0, UINT8_MAX, &mRequest.action); AddArgument("Direction", 0, UINT8_MAX, &mRequest.direction); AddArgument("Time", 0, UINT16_MAX, &mRequest.time); AddArgument("StartHue", 0, UINT16_MAX, &mRequest.startHue); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterColorLoopSetParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.updateFlags = [NSNumber numberWithUnsignedChar:mRequest.updateFlags.Raw()]; params.action = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.action)]; params.direction = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.direction)]; params.time = [NSNumber numberWithUnsignedShort:mRequest.time]; params.startHue = [NSNumber numberWithUnsignedShort:mRequest.startHue]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster colorLoopSetWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type mRequest; }; /* * Command StopMoveStep */ class ColorControlStopMoveStep : public ClusterCommand { public: ColorControlStopMoveStep() : ClusterCommand("stop-move-step") { AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::StopMoveStep::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterStopMoveStepParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stopMoveStepWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::StopMoveStep::Type mRequest; }; /* * Command MoveColorTemperature */ class ColorControlMoveColorTemperature : public ClusterCommand { public: ColorControlMoveColorTemperature() : ClusterCommand("move-color-temperature") { AddArgument("MoveMode", 0, UINT8_MAX, &mRequest.moveMode); AddArgument("Rate", 0, UINT16_MAX, &mRequest.rate); AddArgument("ColorTemperatureMinimumMireds", 0, UINT16_MAX, &mRequest.colorTemperatureMinimumMireds); AddArgument("ColorTemperatureMaximumMireds", 0, UINT16_MAX, &mRequest.colorTemperatureMaximumMireds); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterMoveColorTemperatureParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.moveMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.moveMode)]; params.rate = [NSNumber numberWithUnsignedShort:mRequest.rate]; params.colorTemperatureMinimumMireds = [NSNumber numberWithUnsignedShort:mRequest.colorTemperatureMinimumMireds]; params.colorTemperatureMaximumMireds = [NSNumber numberWithUnsignedShort:mRequest.colorTemperatureMaximumMireds]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster moveColorTemperatureWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::Type mRequest; }; /* * Command StepColorTemperature */ class ColorControlStepColorTemperature : public ClusterCommand { public: ColorControlStepColorTemperature() : ClusterCommand("step-color-temperature") { AddArgument("StepMode", 0, UINT8_MAX, &mRequest.stepMode); AddArgument("StepSize", 0, UINT16_MAX, &mRequest.stepSize); AddArgument("TransitionTime", 0, UINT16_MAX, &mRequest.transitionTime); AddArgument("ColorTemperatureMinimumMireds", 0, UINT16_MAX, &mRequest.colorTemperatureMinimumMireds); AddArgument("ColorTemperatureMaximumMireds", 0, UINT16_MAX, &mRequest.colorTemperatureMaximumMireds); AddArgument("OptionsMask", 0, UINT8_MAX, &mRequest.optionsMask); AddArgument("OptionsOverride", 0, UINT8_MAX, &mRequest.optionsOverride); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ColorControl::Commands::StepColorTemperature::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRColorControlClusterStepColorTemperatureParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.stepMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.stepMode)]; params.stepSize = [NSNumber numberWithUnsignedShort:mRequest.stepSize]; params.transitionTime = [NSNumber numberWithUnsignedShort:mRequest.transitionTime]; params.colorTemperatureMinimumMireds = [NSNumber numberWithUnsignedShort:mRequest.colorTemperatureMinimumMireds]; params.colorTemperatureMaximumMireds = [NSNumber numberWithUnsignedShort:mRequest.colorTemperatureMaximumMireds]; params.optionsMask = [NSNumber numberWithUnsignedChar:mRequest.optionsMask.Raw()]; params.optionsOverride = [NSNumber numberWithUnsignedChar:mRequest.optionsOverride.Raw()]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stepColorTemperatureWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ColorControl::Commands::StepColorTemperature::Type mRequest; }; /* * Attribute CurrentHue */ class ReadColorControlCurrentHue : public ReadAttribute { public: ReadColorControlCurrentHue() : ReadAttribute("current-hue") { } ~ReadColorControlCurrentHue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::CurrentHue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CurrentHue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl CurrentHue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlCurrentHue : public SubscribeAttribute { public: SubscribeAttributeColorControlCurrentHue() : SubscribeAttribute("current-hue") { } ~SubscribeAttributeColorControlCurrentHue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::CurrentHue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentHueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CurrentHue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentSaturation */ class ReadColorControlCurrentSaturation : public ReadAttribute { public: ReadColorControlCurrentSaturation() : ReadAttribute("current-saturation") { } ~ReadColorControlCurrentSaturation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::CurrentSaturation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentSaturationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CurrentSaturation response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl CurrentSaturation read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlCurrentSaturation : public SubscribeAttribute { public: SubscribeAttributeColorControlCurrentSaturation() : SubscribeAttribute("current-saturation") { } ~SubscribeAttributeColorControlCurrentSaturation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::CurrentSaturation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentSaturationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CurrentSaturation response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RemainingTime */ class ReadColorControlRemainingTime : public ReadAttribute { public: ReadColorControlRemainingTime() : ReadAttribute("remaining-time") { } ~ReadColorControlRemainingTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::RemainingTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRemainingTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.RemainingTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl RemainingTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlRemainingTime : public SubscribeAttribute { public: SubscribeAttributeColorControlRemainingTime() : SubscribeAttribute("remaining-time") { } ~SubscribeAttributeColorControlRemainingTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::RemainingTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRemainingTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.RemainingTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentX */ class ReadColorControlCurrentX : public ReadAttribute { public: ReadColorControlCurrentX() : ReadAttribute("current-x") { } ~ReadColorControlCurrentX() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::CurrentX::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentXWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CurrentX response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl CurrentX read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlCurrentX : public SubscribeAttribute { public: SubscribeAttributeColorControlCurrentX() : SubscribeAttribute("current-x") { } ~SubscribeAttributeColorControlCurrentX() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::CurrentX::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentXWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CurrentX response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentY */ class ReadColorControlCurrentY : public ReadAttribute { public: ReadColorControlCurrentY() : ReadAttribute("current-y") { } ~ReadColorControlCurrentY() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::CurrentY::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentYWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CurrentY response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl CurrentY read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlCurrentY : public SubscribeAttribute { public: SubscribeAttributeColorControlCurrentY() : SubscribeAttribute("current-y") { } ~SubscribeAttributeColorControlCurrentY() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::CurrentY::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentYWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CurrentY response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute DriftCompensation */ class ReadColorControlDriftCompensation : public ReadAttribute { public: ReadColorControlDriftCompensation() : ReadAttribute("drift-compensation") { } ~ReadColorControlDriftCompensation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::DriftCompensation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDriftCompensationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.DriftCompensation response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl DriftCompensation read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlDriftCompensation : public SubscribeAttribute { public: SubscribeAttributeColorControlDriftCompensation() : SubscribeAttribute("drift-compensation") { } ~SubscribeAttributeColorControlDriftCompensation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::DriftCompensation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDriftCompensationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.DriftCompensation response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CompensationText */ class ReadColorControlCompensationText : public ReadAttribute { public: ReadColorControlCompensationText() : ReadAttribute("compensation-text") { } ~ReadColorControlCompensationText() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::CompensationText::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCompensationTextWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CompensationText response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl CompensationText read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlCompensationText : public SubscribeAttribute { public: SubscribeAttributeColorControlCompensationText() : SubscribeAttribute("compensation-text") { } ~SubscribeAttributeColorControlCompensationText() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::CompensationText::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCompensationTextWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CompensationText response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorTemperatureMireds */ class ReadColorControlColorTemperatureMireds : public ReadAttribute { public: ReadColorControlColorTemperatureMireds() : ReadAttribute("color-temperature-mireds") { } ~ReadColorControlColorTemperatureMireds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorTemperatureMireds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorTemperatureMiredsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorTemperatureMireds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorTemperatureMireds read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlColorTemperatureMireds : public SubscribeAttribute { public: SubscribeAttributeColorControlColorTemperatureMireds() : SubscribeAttribute("color-temperature-mireds") { } ~SubscribeAttributeColorControlColorTemperatureMireds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorTemperatureMireds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorTemperatureMiredsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorTemperatureMireds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorMode */ class ReadColorControlColorMode : public ReadAttribute { public: ReadColorControlColorMode() : ReadAttribute("color-mode") { } ~ReadColorControlColorMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlColorMode : public SubscribeAttribute { public: SubscribeAttributeColorControlColorMode() : SubscribeAttribute("color-mode") { } ~SubscribeAttributeColorControlColorMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Options */ class ReadColorControlOptions : public ReadAttribute { public: ReadColorControlOptions() : ReadAttribute("options") { } ~ReadColorControlOptions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Options::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOptionsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Options response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Options read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteColorControlOptions : public WriteAttribute { public: WriteColorControlOptions() : WriteAttribute("options") { AddArgument("attr-name", "options"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteColorControlOptions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Options::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeOptionsWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ColorControl Options write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeColorControlOptions : public SubscribeAttribute { public: SubscribeAttributeColorControlOptions() : SubscribeAttribute("options") { } ~SubscribeAttributeColorControlOptions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Options::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOptionsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Options response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NumberOfPrimaries */ class ReadColorControlNumberOfPrimaries : public ReadAttribute { public: ReadColorControlNumberOfPrimaries() : ReadAttribute("number-of-primaries") { } ~ReadColorControlNumberOfPrimaries() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::NumberOfPrimaries::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNumberOfPrimariesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.NumberOfPrimaries response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl NumberOfPrimaries read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlNumberOfPrimaries : public SubscribeAttribute { public: SubscribeAttributeColorControlNumberOfPrimaries() : SubscribeAttribute("number-of-primaries") { } ~SubscribeAttributeColorControlNumberOfPrimaries() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::NumberOfPrimaries::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNumberOfPrimariesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.NumberOfPrimaries response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary1X */ class ReadColorControlPrimary1X : public ReadAttribute { public: ReadColorControlPrimary1X() : ReadAttribute("primary1x") { } ~ReadColorControlPrimary1X() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary1X::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary1XWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary1X response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary1X read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary1X : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary1X() : SubscribeAttribute("primary1x") { } ~SubscribeAttributeColorControlPrimary1X() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary1X::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary1XWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary1X response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary1Y */ class ReadColorControlPrimary1Y : public ReadAttribute { public: ReadColorControlPrimary1Y() : ReadAttribute("primary1y") { } ~ReadColorControlPrimary1Y() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary1Y::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary1YWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary1Y response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary1Y read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary1Y : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary1Y() : SubscribeAttribute("primary1y") { } ~SubscribeAttributeColorControlPrimary1Y() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary1Y::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary1YWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary1Y response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary1Intensity */ class ReadColorControlPrimary1Intensity : public ReadAttribute { public: ReadColorControlPrimary1Intensity() : ReadAttribute("primary1intensity") { } ~ReadColorControlPrimary1Intensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary1Intensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary1IntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary1Intensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary1Intensity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary1Intensity : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary1Intensity() : SubscribeAttribute("primary1intensity") { } ~SubscribeAttributeColorControlPrimary1Intensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary1Intensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary1IntensityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary1Intensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary2X */ class ReadColorControlPrimary2X : public ReadAttribute { public: ReadColorControlPrimary2X() : ReadAttribute("primary2x") { } ~ReadColorControlPrimary2X() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary2X::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary2XWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary2X response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary2X read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary2X : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary2X() : SubscribeAttribute("primary2x") { } ~SubscribeAttributeColorControlPrimary2X() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary2X::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary2XWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary2X response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary2Y */ class ReadColorControlPrimary2Y : public ReadAttribute { public: ReadColorControlPrimary2Y() : ReadAttribute("primary2y") { } ~ReadColorControlPrimary2Y() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary2Y::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary2YWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary2Y response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary2Y read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary2Y : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary2Y() : SubscribeAttribute("primary2y") { } ~SubscribeAttributeColorControlPrimary2Y() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary2Y::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary2YWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary2Y response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary2Intensity */ class ReadColorControlPrimary2Intensity : public ReadAttribute { public: ReadColorControlPrimary2Intensity() : ReadAttribute("primary2intensity") { } ~ReadColorControlPrimary2Intensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary2Intensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary2IntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary2Intensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary2Intensity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary2Intensity : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary2Intensity() : SubscribeAttribute("primary2intensity") { } ~SubscribeAttributeColorControlPrimary2Intensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary2Intensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary2IntensityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary2Intensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary3X */ class ReadColorControlPrimary3X : public ReadAttribute { public: ReadColorControlPrimary3X() : ReadAttribute("primary3x") { } ~ReadColorControlPrimary3X() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary3X::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary3XWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary3X response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary3X read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary3X : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary3X() : SubscribeAttribute("primary3x") { } ~SubscribeAttributeColorControlPrimary3X() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary3X::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary3XWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary3X response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary3Y */ class ReadColorControlPrimary3Y : public ReadAttribute { public: ReadColorControlPrimary3Y() : ReadAttribute("primary3y") { } ~ReadColorControlPrimary3Y() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary3Y::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary3YWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary3Y response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary3Y read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary3Y : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary3Y() : SubscribeAttribute("primary3y") { } ~SubscribeAttributeColorControlPrimary3Y() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary3Y::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary3YWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary3Y response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary3Intensity */ class ReadColorControlPrimary3Intensity : public ReadAttribute { public: ReadColorControlPrimary3Intensity() : ReadAttribute("primary3intensity") { } ~ReadColorControlPrimary3Intensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary3Intensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary3IntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary3Intensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary3Intensity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary3Intensity : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary3Intensity() : SubscribeAttribute("primary3intensity") { } ~SubscribeAttributeColorControlPrimary3Intensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary3Intensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary3IntensityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary3Intensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary4X */ class ReadColorControlPrimary4X : public ReadAttribute { public: ReadColorControlPrimary4X() : ReadAttribute("primary4x") { } ~ReadColorControlPrimary4X() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary4X::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary4XWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary4X response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary4X read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary4X : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary4X() : SubscribeAttribute("primary4x") { } ~SubscribeAttributeColorControlPrimary4X() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary4X::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary4XWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary4X response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary4Y */ class ReadColorControlPrimary4Y : public ReadAttribute { public: ReadColorControlPrimary4Y() : ReadAttribute("primary4y") { } ~ReadColorControlPrimary4Y() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary4Y::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary4YWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary4Y response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary4Y read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary4Y : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary4Y() : SubscribeAttribute("primary4y") { } ~SubscribeAttributeColorControlPrimary4Y() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary4Y::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary4YWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary4Y response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary4Intensity */ class ReadColorControlPrimary4Intensity : public ReadAttribute { public: ReadColorControlPrimary4Intensity() : ReadAttribute("primary4intensity") { } ~ReadColorControlPrimary4Intensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary4Intensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary4IntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary4Intensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary4Intensity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary4Intensity : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary4Intensity() : SubscribeAttribute("primary4intensity") { } ~SubscribeAttributeColorControlPrimary4Intensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary4Intensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary4IntensityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary4Intensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary5X */ class ReadColorControlPrimary5X : public ReadAttribute { public: ReadColorControlPrimary5X() : ReadAttribute("primary5x") { } ~ReadColorControlPrimary5X() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary5X::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary5XWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary5X response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary5X read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary5X : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary5X() : SubscribeAttribute("primary5x") { } ~SubscribeAttributeColorControlPrimary5X() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary5X::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary5XWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary5X response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary5Y */ class ReadColorControlPrimary5Y : public ReadAttribute { public: ReadColorControlPrimary5Y() : ReadAttribute("primary5y") { } ~ReadColorControlPrimary5Y() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary5Y::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary5YWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary5Y response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary5Y read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary5Y : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary5Y() : SubscribeAttribute("primary5y") { } ~SubscribeAttributeColorControlPrimary5Y() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary5Y::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary5YWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary5Y response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary5Intensity */ class ReadColorControlPrimary5Intensity : public ReadAttribute { public: ReadColorControlPrimary5Intensity() : ReadAttribute("primary5intensity") { } ~ReadColorControlPrimary5Intensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary5Intensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary5IntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary5Intensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary5Intensity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary5Intensity : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary5Intensity() : SubscribeAttribute("primary5intensity") { } ~SubscribeAttributeColorControlPrimary5Intensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary5Intensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary5IntensityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary5Intensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary6X */ class ReadColorControlPrimary6X : public ReadAttribute { public: ReadColorControlPrimary6X() : ReadAttribute("primary6x") { } ~ReadColorControlPrimary6X() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary6X::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary6XWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary6X response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary6X read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary6X : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary6X() : SubscribeAttribute("primary6x") { } ~SubscribeAttributeColorControlPrimary6X() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary6X::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary6XWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary6X response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary6Y */ class ReadColorControlPrimary6Y : public ReadAttribute { public: ReadColorControlPrimary6Y() : ReadAttribute("primary6y") { } ~ReadColorControlPrimary6Y() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary6Y::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary6YWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary6Y response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary6Y read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary6Y : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary6Y() : SubscribeAttribute("primary6y") { } ~SubscribeAttributeColorControlPrimary6Y() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary6Y::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary6YWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary6Y response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Primary6Intensity */ class ReadColorControlPrimary6Intensity : public ReadAttribute { public: ReadColorControlPrimary6Intensity() : ReadAttribute("primary6intensity") { } ~ReadColorControlPrimary6Intensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary6Intensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePrimary6IntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary6Intensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl Primary6Intensity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlPrimary6Intensity : public SubscribeAttribute { public: SubscribeAttributeColorControlPrimary6Intensity() : SubscribeAttribute("primary6intensity") { } ~SubscribeAttributeColorControlPrimary6Intensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::Primary6Intensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePrimary6IntensityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary6Intensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute WhitePointX */ class ReadColorControlWhitePointX : public ReadAttribute { public: ReadColorControlWhitePointX() : ReadAttribute("white-point-x") { } ~ReadColorControlWhitePointX() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::WhitePointX::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWhitePointXWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.WhitePointX response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl WhitePointX read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteColorControlWhitePointX : public WriteAttribute { public: WriteColorControlWhitePointX() : WriteAttribute("white-point-x") { AddArgument("attr-name", "white-point-x"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteColorControlWhitePointX() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::WhitePointX::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeWhitePointXWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ColorControl WhitePointX write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeColorControlWhitePointX : public SubscribeAttribute { public: SubscribeAttributeColorControlWhitePointX() : SubscribeAttribute("white-point-x") { } ~SubscribeAttributeColorControlWhitePointX() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::WhitePointX::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWhitePointXWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.WhitePointX response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute WhitePointY */ class ReadColorControlWhitePointY : public ReadAttribute { public: ReadColorControlWhitePointY() : ReadAttribute("white-point-y") { } ~ReadColorControlWhitePointY() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::WhitePointY::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWhitePointYWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.WhitePointY response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl WhitePointY read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteColorControlWhitePointY : public WriteAttribute { public: WriteColorControlWhitePointY() : WriteAttribute("white-point-y") { AddArgument("attr-name", "white-point-y"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteColorControlWhitePointY() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::WhitePointY::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeWhitePointYWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ColorControl WhitePointY write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeColorControlWhitePointY : public SubscribeAttribute { public: SubscribeAttributeColorControlWhitePointY() : SubscribeAttribute("white-point-y") { } ~SubscribeAttributeColorControlWhitePointY() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::WhitePointY::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWhitePointYWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.WhitePointY response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorPointRX */ class ReadColorControlColorPointRX : public ReadAttribute { public: ReadColorControlColorPointRX() : ReadAttribute("color-point-rx") { } ~ReadColorControlColorPointRX() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointRX::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorPointRXWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointRX response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorPointRX read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteColorControlColorPointRX : public WriteAttribute { public: WriteColorControlColorPointRX() : WriteAttribute("color-point-rx") { AddArgument("attr-name", "color-point-rx"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteColorControlColorPointRX() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointRX::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeColorPointRXWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ColorControl ColorPointRX write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeColorControlColorPointRX : public SubscribeAttribute { public: SubscribeAttributeColorControlColorPointRX() : SubscribeAttribute("color-point-rx") { } ~SubscribeAttributeColorControlColorPointRX() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointRX::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorPointRXWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointRX response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorPointRY */ class ReadColorControlColorPointRY : public ReadAttribute { public: ReadColorControlColorPointRY() : ReadAttribute("color-point-ry") { } ~ReadColorControlColorPointRY() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointRY::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorPointRYWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointRY response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorPointRY read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteColorControlColorPointRY : public WriteAttribute { public: WriteColorControlColorPointRY() : WriteAttribute("color-point-ry") { AddArgument("attr-name", "color-point-ry"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteColorControlColorPointRY() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointRY::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeColorPointRYWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ColorControl ColorPointRY write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeColorControlColorPointRY : public SubscribeAttribute { public: SubscribeAttributeColorControlColorPointRY() : SubscribeAttribute("color-point-ry") { } ~SubscribeAttributeColorControlColorPointRY() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointRY::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorPointRYWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointRY response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorPointRIntensity */ class ReadColorControlColorPointRIntensity : public ReadAttribute { public: ReadColorControlColorPointRIntensity() : ReadAttribute("color-point-rintensity") { } ~ReadColorControlColorPointRIntensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointRIntensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorPointRIntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointRIntensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorPointRIntensity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteColorControlColorPointRIntensity : public WriteAttribute { public: WriteColorControlColorPointRIntensity() : WriteAttribute("color-point-rintensity") { AddArgument("attr-name", "color-point-rintensity"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteColorControlColorPointRIntensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointRIntensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeColorPointRIntensityWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ColorControl ColorPointRIntensity write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeColorControlColorPointRIntensity : public SubscribeAttribute { public: SubscribeAttributeColorControlColorPointRIntensity() : SubscribeAttribute("color-point-rintensity") { } ~SubscribeAttributeColorControlColorPointRIntensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointRIntensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorPointRIntensityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointRIntensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorPointGX */ class ReadColorControlColorPointGX : public ReadAttribute { public: ReadColorControlColorPointGX() : ReadAttribute("color-point-gx") { } ~ReadColorControlColorPointGX() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointGX::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorPointGXWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointGX response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorPointGX read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteColorControlColorPointGX : public WriteAttribute { public: WriteColorControlColorPointGX() : WriteAttribute("color-point-gx") { AddArgument("attr-name", "color-point-gx"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteColorControlColorPointGX() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointGX::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeColorPointGXWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ColorControl ColorPointGX write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeColorControlColorPointGX : public SubscribeAttribute { public: SubscribeAttributeColorControlColorPointGX() : SubscribeAttribute("color-point-gx") { } ~SubscribeAttributeColorControlColorPointGX() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointGX::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorPointGXWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointGX response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorPointGY */ class ReadColorControlColorPointGY : public ReadAttribute { public: ReadColorControlColorPointGY() : ReadAttribute("color-point-gy") { } ~ReadColorControlColorPointGY() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointGY::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorPointGYWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointGY response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorPointGY read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteColorControlColorPointGY : public WriteAttribute { public: WriteColorControlColorPointGY() : WriteAttribute("color-point-gy") { AddArgument("attr-name", "color-point-gy"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteColorControlColorPointGY() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointGY::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeColorPointGYWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ColorControl ColorPointGY write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeColorControlColorPointGY : public SubscribeAttribute { public: SubscribeAttributeColorControlColorPointGY() : SubscribeAttribute("color-point-gy") { } ~SubscribeAttributeColorControlColorPointGY() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointGY::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorPointGYWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointGY response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorPointGIntensity */ class ReadColorControlColorPointGIntensity : public ReadAttribute { public: ReadColorControlColorPointGIntensity() : ReadAttribute("color-point-gintensity") { } ~ReadColorControlColorPointGIntensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointGIntensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorPointGIntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointGIntensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorPointGIntensity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteColorControlColorPointGIntensity : public WriteAttribute { public: WriteColorControlColorPointGIntensity() : WriteAttribute("color-point-gintensity") { AddArgument("attr-name", "color-point-gintensity"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteColorControlColorPointGIntensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointGIntensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeColorPointGIntensityWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ColorControl ColorPointGIntensity write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeColorControlColorPointGIntensity : public SubscribeAttribute { public: SubscribeAttributeColorControlColorPointGIntensity() : SubscribeAttribute("color-point-gintensity") { } ~SubscribeAttributeColorControlColorPointGIntensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointGIntensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorPointGIntensityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointGIntensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorPointBX */ class ReadColorControlColorPointBX : public ReadAttribute { public: ReadColorControlColorPointBX() : ReadAttribute("color-point-bx") { } ~ReadColorControlColorPointBX() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointBX::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorPointBXWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointBX response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorPointBX read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteColorControlColorPointBX : public WriteAttribute { public: WriteColorControlColorPointBX() : WriteAttribute("color-point-bx") { AddArgument("attr-name", "color-point-bx"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteColorControlColorPointBX() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointBX::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeColorPointBXWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ColorControl ColorPointBX write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeColorControlColorPointBX : public SubscribeAttribute { public: SubscribeAttributeColorControlColorPointBX() : SubscribeAttribute("color-point-bx") { } ~SubscribeAttributeColorControlColorPointBX() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointBX::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorPointBXWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointBX response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorPointBY */ class ReadColorControlColorPointBY : public ReadAttribute { public: ReadColorControlColorPointBY() : ReadAttribute("color-point-by") { } ~ReadColorControlColorPointBY() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointBY::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorPointBYWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointBY response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorPointBY read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteColorControlColorPointBY : public WriteAttribute { public: WriteColorControlColorPointBY() : WriteAttribute("color-point-by") { AddArgument("attr-name", "color-point-by"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteColorControlColorPointBY() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointBY::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeColorPointBYWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ColorControl ColorPointBY write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeColorControlColorPointBY : public SubscribeAttribute { public: SubscribeAttributeColorControlColorPointBY() : SubscribeAttribute("color-point-by") { } ~SubscribeAttributeColorControlColorPointBY() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointBY::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorPointBYWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointBY response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorPointBIntensity */ class ReadColorControlColorPointBIntensity : public ReadAttribute { public: ReadColorControlColorPointBIntensity() : ReadAttribute("color-point-bintensity") { } ~ReadColorControlColorPointBIntensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointBIntensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorPointBIntensityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointBIntensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorPointBIntensity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteColorControlColorPointBIntensity : public WriteAttribute { public: WriteColorControlColorPointBIntensity() : WriteAttribute("color-point-bintensity") { AddArgument("attr-name", "color-point-bintensity"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteColorControlColorPointBIntensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointBIntensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeColorPointBIntensityWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ColorControl ColorPointBIntensity write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeColorControlColorPointBIntensity : public SubscribeAttribute { public: SubscribeAttributeColorControlColorPointBIntensity() : SubscribeAttribute("color-point-bintensity") { } ~SubscribeAttributeColorControlColorPointBIntensity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorPointBIntensity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorPointBIntensityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointBIntensity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute EnhancedCurrentHue */ class ReadColorControlEnhancedCurrentHue : public ReadAttribute { public: ReadColorControlEnhancedCurrentHue() : ReadAttribute("enhanced-current-hue") { } ~ReadColorControlEnhancedCurrentHue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::EnhancedCurrentHue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEnhancedCurrentHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.EnhancedCurrentHue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl EnhancedCurrentHue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlEnhancedCurrentHue : public SubscribeAttribute { public: SubscribeAttributeColorControlEnhancedCurrentHue() : SubscribeAttribute("enhanced-current-hue") { } ~SubscribeAttributeColorControlEnhancedCurrentHue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::EnhancedCurrentHue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEnhancedCurrentHueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.EnhancedCurrentHue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute EnhancedColorMode */ class ReadColorControlEnhancedColorMode : public ReadAttribute { public: ReadColorControlEnhancedColorMode() : ReadAttribute("enhanced-color-mode") { } ~ReadColorControlEnhancedColorMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::EnhancedColorMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEnhancedColorModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.EnhancedColorMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl EnhancedColorMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlEnhancedColorMode : public SubscribeAttribute { public: SubscribeAttributeColorControlEnhancedColorMode() : SubscribeAttribute("enhanced-color-mode") { } ~SubscribeAttributeColorControlEnhancedColorMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::EnhancedColorMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEnhancedColorModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.EnhancedColorMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorLoopActive */ class ReadColorControlColorLoopActive : public ReadAttribute { public: ReadColorControlColorLoopActive() : ReadAttribute("color-loop-active") { } ~ReadColorControlColorLoopActive() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorLoopActive::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorLoopActiveWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorLoopActive response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorLoopActive read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlColorLoopActive : public SubscribeAttribute { public: SubscribeAttributeColorControlColorLoopActive() : SubscribeAttribute("color-loop-active") { } ~SubscribeAttributeColorControlColorLoopActive() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorLoopActive::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorLoopActiveWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorLoopActive response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorLoopDirection */ class ReadColorControlColorLoopDirection : public ReadAttribute { public: ReadColorControlColorLoopDirection() : ReadAttribute("color-loop-direction") { } ~ReadColorControlColorLoopDirection() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorLoopDirection::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorLoopDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorLoopDirection response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorLoopDirection read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlColorLoopDirection : public SubscribeAttribute { public: SubscribeAttributeColorControlColorLoopDirection() : SubscribeAttribute("color-loop-direction") { } ~SubscribeAttributeColorControlColorLoopDirection() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorLoopDirection::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorLoopDirectionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorLoopDirection response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorLoopTime */ class ReadColorControlColorLoopTime : public ReadAttribute { public: ReadColorControlColorLoopTime() : ReadAttribute("color-loop-time") { } ~ReadColorControlColorLoopTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorLoopTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorLoopTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorLoopTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorLoopTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlColorLoopTime : public SubscribeAttribute { public: SubscribeAttributeColorControlColorLoopTime() : SubscribeAttribute("color-loop-time") { } ~SubscribeAttributeColorControlColorLoopTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorLoopTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorLoopTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorLoopTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorLoopStartEnhancedHue */ class ReadColorControlColorLoopStartEnhancedHue : public ReadAttribute { public: ReadColorControlColorLoopStartEnhancedHue() : ReadAttribute("color-loop-start-enhanced-hue") { } ~ReadColorControlColorLoopStartEnhancedHue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorLoopStartEnhancedHue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorLoopStartEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorLoopStartEnhancedHue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorLoopStartEnhancedHue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlColorLoopStartEnhancedHue : public SubscribeAttribute { public: SubscribeAttributeColorControlColorLoopStartEnhancedHue() : SubscribeAttribute("color-loop-start-enhanced-hue") { } ~SubscribeAttributeColorControlColorLoopStartEnhancedHue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorLoopStartEnhancedHue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorLoopStartEnhancedHueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorLoopStartEnhancedHue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorLoopStoredEnhancedHue */ class ReadColorControlColorLoopStoredEnhancedHue : public ReadAttribute { public: ReadColorControlColorLoopStoredEnhancedHue() : ReadAttribute("color-loop-stored-enhanced-hue") { } ~ReadColorControlColorLoopStoredEnhancedHue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorLoopStoredEnhancedHueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorLoopStoredEnhancedHue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorLoopStoredEnhancedHue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlColorLoopStoredEnhancedHue : public SubscribeAttribute { public: SubscribeAttributeColorControlColorLoopStoredEnhancedHue() : SubscribeAttribute("color-loop-stored-enhanced-hue") { } ~SubscribeAttributeColorControlColorLoopStoredEnhancedHue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorLoopStoredEnhancedHue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorLoopStoredEnhancedHueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorLoopStoredEnhancedHue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorCapabilities */ class ReadColorControlColorCapabilities : public ReadAttribute { public: ReadColorControlColorCapabilities() : ReadAttribute("color-capabilities") { } ~ReadColorControlColorCapabilities() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorCapabilities::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorCapabilitiesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorCapabilities response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorCapabilities read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlColorCapabilities : public SubscribeAttribute { public: SubscribeAttributeColorControlColorCapabilities() : SubscribeAttribute("color-capabilities") { } ~SubscribeAttributeColorControlColorCapabilities() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorCapabilities::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorCapabilitiesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorCapabilities response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorTempPhysicalMinMireds */ class ReadColorControlColorTempPhysicalMinMireds : public ReadAttribute { public: ReadColorControlColorTempPhysicalMinMireds() : ReadAttribute("color-temp-physical-min-mireds") { } ~ReadColorControlColorTempPhysicalMinMireds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorTempPhysicalMinMireds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorTempPhysicalMinMiredsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorTempPhysicalMinMireds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorTempPhysicalMinMireds read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlColorTempPhysicalMinMireds : public SubscribeAttribute { public: SubscribeAttributeColorControlColorTempPhysicalMinMireds() : SubscribeAttribute("color-temp-physical-min-mireds") { } ~SubscribeAttributeColorControlColorTempPhysicalMinMireds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorTempPhysicalMinMireds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorTempPhysicalMinMiredsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorTempPhysicalMinMireds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ColorTempPhysicalMaxMireds */ class ReadColorControlColorTempPhysicalMaxMireds : public ReadAttribute { public: ReadColorControlColorTempPhysicalMaxMireds() : ReadAttribute("color-temp-physical-max-mireds") { } ~ReadColorControlColorTempPhysicalMaxMireds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorTempPhysicalMaxMireds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeColorTempPhysicalMaxMiredsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorTempPhysicalMaxMireds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ColorTempPhysicalMaxMireds read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlColorTempPhysicalMaxMireds : public SubscribeAttribute { public: SubscribeAttributeColorControlColorTempPhysicalMaxMireds() : SubscribeAttribute("color-temp-physical-max-mireds") { } ~SubscribeAttributeColorControlColorTempPhysicalMaxMireds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ColorTempPhysicalMaxMireds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeColorTempPhysicalMaxMiredsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorTempPhysicalMaxMireds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CoupleColorTempToLevelMinMireds */ class ReadColorControlCoupleColorTempToLevelMinMireds : public ReadAttribute { public: ReadColorControlCoupleColorTempToLevelMinMireds() : ReadAttribute("couple-color-temp-to-level-min-mireds") { } ~ReadColorControlCoupleColorTempToLevelMinMireds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::CoupleColorTempToLevelMinMireds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCoupleColorTempToLevelMinMiredsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CoupleColorTempToLevelMinMireds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl CoupleColorTempToLevelMinMireds read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlCoupleColorTempToLevelMinMireds : public SubscribeAttribute { public: SubscribeAttributeColorControlCoupleColorTempToLevelMinMireds() : SubscribeAttribute("couple-color-temp-to-level-min-mireds") { } ~SubscribeAttributeColorControlCoupleColorTempToLevelMinMireds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::CoupleColorTempToLevelMinMireds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCoupleColorTempToLevelMinMiredsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CoupleColorTempToLevelMinMireds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute StartUpColorTemperatureMireds */ class ReadColorControlStartUpColorTemperatureMireds : public ReadAttribute { public: ReadColorControlStartUpColorTemperatureMireds() : ReadAttribute("start-up-color-temperature-mireds") { } ~ReadColorControlStartUpColorTemperatureMireds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::StartUpColorTemperatureMireds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStartUpColorTemperatureMiredsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.StartUpColorTemperatureMireds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl StartUpColorTemperatureMireds read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteColorControlStartUpColorTemperatureMireds : public WriteAttribute { public: WriteColorControlStartUpColorTemperatureMireds() : WriteAttribute("start-up-color-temperature-mireds") { AddArgument("attr-name", "start-up-color-temperature-mireds"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteColorControlStartUpColorTemperatureMireds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::StartUpColorTemperatureMireds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedShort:mValue.Value()]; } [cluster writeAttributeStartUpColorTemperatureMiredsWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ColorControl StartUpColorTemperatureMireds write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeColorControlStartUpColorTemperatureMireds : public SubscribeAttribute { public: SubscribeAttributeColorControlStartUpColorTemperatureMireds() : SubscribeAttribute("start-up-color-temperature-mireds") { } ~SubscribeAttributeColorControlStartUpColorTemperatureMireds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::StartUpColorTemperatureMireds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStartUpColorTemperatureMiredsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.StartUpColorTemperatureMireds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadColorControlGeneratedCommandList : public ReadAttribute { public: ReadColorControlGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadColorControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeColorControlGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeColorControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadColorControlAcceptedCommandList : public ReadAttribute { public: ReadColorControlAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadColorControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeColorControlAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeColorControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadColorControlEventList : public ReadAttribute { public: ReadColorControlEventList() : ReadAttribute("event-list") { } ~ReadColorControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlEventList : public SubscribeAttribute { public: SubscribeAttributeColorControlEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeColorControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadColorControlAttributeList : public ReadAttribute { public: ReadColorControlAttributeList() : ReadAttribute("attribute-list") { } ~ReadColorControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlAttributeList : public SubscribeAttribute { public: SubscribeAttributeColorControlAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeColorControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadColorControlFeatureMap : public ReadAttribute { public: ReadColorControlFeatureMap() : ReadAttribute("feature-map") { } ~ReadColorControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlFeatureMap : public SubscribeAttribute { public: SubscribeAttributeColorControlFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeColorControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadColorControlClusterRevision : public ReadAttribute { public: ReadColorControlClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadColorControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ColorControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ColorControl ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeColorControlClusterRevision : public SubscribeAttribute { public: SubscribeAttributeColorControlClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeColorControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ColorControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ColorControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster BallastConfiguration | 0x0301 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * PhysicalMinLevel | 0x0000 | | * PhysicalMaxLevel | 0x0001 | | * BallastStatus | 0x0002 | | * MinLevel | 0x0010 | | * MaxLevel | 0x0011 | | * IntrinsicBallastFactor | 0x0014 | | * BallastFactorAdjustment | 0x0015 | | * LampQuantity | 0x0020 | | * LampType | 0x0030 | | * LampManufacturer | 0x0031 | | * LampRatedHours | 0x0032 | | * LampBurnHours | 0x0033 | | * LampAlarmMode | 0x0034 | | * LampBurnHoursTripPoint | 0x0035 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute PhysicalMinLevel */ class ReadBallastConfigurationPhysicalMinLevel : public ReadAttribute { public: ReadBallastConfigurationPhysicalMinLevel() : ReadAttribute("physical-min-level") { } ~ReadBallastConfigurationPhysicalMinLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::PhysicalMinLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePhysicalMinLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.PhysicalMinLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration PhysicalMinLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBallastConfigurationPhysicalMinLevel : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationPhysicalMinLevel() : SubscribeAttribute("physical-min-level") { } ~SubscribeAttributeBallastConfigurationPhysicalMinLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::PhysicalMinLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePhysicalMinLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.PhysicalMinLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PhysicalMaxLevel */ class ReadBallastConfigurationPhysicalMaxLevel : public ReadAttribute { public: ReadBallastConfigurationPhysicalMaxLevel() : ReadAttribute("physical-max-level") { } ~ReadBallastConfigurationPhysicalMaxLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::PhysicalMaxLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePhysicalMaxLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.PhysicalMaxLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration PhysicalMaxLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBallastConfigurationPhysicalMaxLevel : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationPhysicalMaxLevel() : SubscribeAttribute("physical-max-level") { } ~SubscribeAttributeBallastConfigurationPhysicalMaxLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::PhysicalMaxLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePhysicalMaxLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.PhysicalMaxLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BallastStatus */ class ReadBallastConfigurationBallastStatus : public ReadAttribute { public: ReadBallastConfigurationBallastStatus() : ReadAttribute("ballast-status") { } ~ReadBallastConfigurationBallastStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::BallastStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBallastStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.BallastStatus response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration BallastStatus read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBallastConfigurationBallastStatus : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationBallastStatus() : SubscribeAttribute("ballast-status") { } ~SubscribeAttributeBallastConfigurationBallastStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::BallastStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBallastStatusWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.BallastStatus response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinLevel */ class ReadBallastConfigurationMinLevel : public ReadAttribute { public: ReadBallastConfigurationMinLevel() : ReadAttribute("min-level") { } ~ReadBallastConfigurationMinLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::MinLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.MinLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration MinLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteBallastConfigurationMinLevel : public WriteAttribute { public: WriteBallastConfigurationMinLevel() : WriteAttribute("min-level") { AddArgument("attr-name", "min-level"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteBallastConfigurationMinLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::MinLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeMinLevelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("BallastConfiguration MinLevel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeBallastConfigurationMinLevel : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationMinLevel() : SubscribeAttribute("min-level") { } ~SubscribeAttributeBallastConfigurationMinLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::MinLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.MinLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxLevel */ class ReadBallastConfigurationMaxLevel : public ReadAttribute { public: ReadBallastConfigurationMaxLevel() : ReadAttribute("max-level") { } ~ReadBallastConfigurationMaxLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::MaxLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.MaxLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration MaxLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteBallastConfigurationMaxLevel : public WriteAttribute { public: WriteBallastConfigurationMaxLevel() : WriteAttribute("max-level") { AddArgument("attr-name", "max-level"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteBallastConfigurationMaxLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::MaxLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeMaxLevelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("BallastConfiguration MaxLevel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeBallastConfigurationMaxLevel : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationMaxLevel() : SubscribeAttribute("max-level") { } ~SubscribeAttributeBallastConfigurationMaxLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::MaxLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.MaxLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute IntrinsicBallastFactor */ class ReadBallastConfigurationIntrinsicBallastFactor : public ReadAttribute { public: ReadBallastConfigurationIntrinsicBallastFactor() : ReadAttribute("intrinsic-ballast-factor") { } ~ReadBallastConfigurationIntrinsicBallastFactor() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::IntrinsicBallastFactor::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeIntrinsicBallastFactorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.IntrinsicBallastFactor response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration IntrinsicBallastFactor read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteBallastConfigurationIntrinsicBallastFactor : public WriteAttribute { public: WriteBallastConfigurationIntrinsicBallastFactor() : WriteAttribute("intrinsic-ballast-factor") { AddArgument("attr-name", "intrinsic-ballast-factor"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteBallastConfigurationIntrinsicBallastFactor() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::IntrinsicBallastFactor::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeIntrinsicBallastFactorWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("BallastConfiguration IntrinsicBallastFactor write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeBallastConfigurationIntrinsicBallastFactor : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationIntrinsicBallastFactor() : SubscribeAttribute("intrinsic-ballast-factor") { } ~SubscribeAttributeBallastConfigurationIntrinsicBallastFactor() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::IntrinsicBallastFactor::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeIntrinsicBallastFactorWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.IntrinsicBallastFactor response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute BallastFactorAdjustment */ class ReadBallastConfigurationBallastFactorAdjustment : public ReadAttribute { public: ReadBallastConfigurationBallastFactorAdjustment() : ReadAttribute("ballast-factor-adjustment") { } ~ReadBallastConfigurationBallastFactorAdjustment() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::BallastFactorAdjustment::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBallastFactorAdjustmentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.BallastFactorAdjustment response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration BallastFactorAdjustment read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteBallastConfigurationBallastFactorAdjustment : public WriteAttribute { public: WriteBallastConfigurationBallastFactorAdjustment() : WriteAttribute("ballast-factor-adjustment") { AddArgument("attr-name", "ballast-factor-adjustment"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteBallastConfigurationBallastFactorAdjustment() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::BallastFactorAdjustment::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeBallastFactorAdjustmentWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("BallastConfiguration BallastFactorAdjustment write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeBallastConfigurationBallastFactorAdjustment : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationBallastFactorAdjustment() : SubscribeAttribute("ballast-factor-adjustment") { } ~SubscribeAttributeBallastConfigurationBallastFactorAdjustment() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::BallastFactorAdjustment::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBallastFactorAdjustmentWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.BallastFactorAdjustment response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LampQuantity */ class ReadBallastConfigurationLampQuantity : public ReadAttribute { public: ReadBallastConfigurationLampQuantity() : ReadAttribute("lamp-quantity") { } ~ReadBallastConfigurationLampQuantity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampQuantity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLampQuantityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.LampQuantity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration LampQuantity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBallastConfigurationLampQuantity : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationLampQuantity() : SubscribeAttribute("lamp-quantity") { } ~SubscribeAttributeBallastConfigurationLampQuantity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampQuantity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLampQuantityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.LampQuantity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LampType */ class ReadBallastConfigurationLampType : public ReadAttribute { public: ReadBallastConfigurationLampType() : ReadAttribute("lamp-type") { } ~ReadBallastConfigurationLampType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLampTypeWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.LampType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration LampType read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteBallastConfigurationLampType : public WriteAttribute { public: WriteBallastConfigurationLampType() : WriteAttribute("lamp-type") { AddArgument("attr-name", "lamp-type"); AddArgument("attr-value", &mValue); WriteAttribute::AddArguments(); } ~WriteBallastConfigurationLampType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() length:mValue.size() encoding:NSUTF8StringEncoding]; [cluster writeAttributeLampTypeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("BallastConfiguration LampType write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::ByteSpan mValue; }; class SubscribeAttributeBallastConfigurationLampType : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationLampType() : SubscribeAttribute("lamp-type") { } ~SubscribeAttributeBallastConfigurationLampType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLampTypeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.LampType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LampManufacturer */ class ReadBallastConfigurationLampManufacturer : public ReadAttribute { public: ReadBallastConfigurationLampManufacturer() : ReadAttribute("lamp-manufacturer") { } ~ReadBallastConfigurationLampManufacturer() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampManufacturer::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLampManufacturerWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.LampManufacturer response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration LampManufacturer read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteBallastConfigurationLampManufacturer : public WriteAttribute { public: WriteBallastConfigurationLampManufacturer() : WriteAttribute("lamp-manufacturer") { AddArgument("attr-name", "lamp-manufacturer"); AddArgument("attr-value", &mValue); WriteAttribute::AddArguments(); } ~WriteBallastConfigurationLampManufacturer() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampManufacturer::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() length:mValue.size() encoding:NSUTF8StringEncoding]; [cluster writeAttributeLampManufacturerWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("BallastConfiguration LampManufacturer write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::ByteSpan mValue; }; class SubscribeAttributeBallastConfigurationLampManufacturer : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationLampManufacturer() : SubscribeAttribute("lamp-manufacturer") { } ~SubscribeAttributeBallastConfigurationLampManufacturer() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampManufacturer::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLampManufacturerWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.LampManufacturer response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LampRatedHours */ class ReadBallastConfigurationLampRatedHours : public ReadAttribute { public: ReadBallastConfigurationLampRatedHours() : ReadAttribute("lamp-rated-hours") { } ~ReadBallastConfigurationLampRatedHours() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampRatedHours::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLampRatedHoursWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.LampRatedHours response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration LampRatedHours read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteBallastConfigurationLampRatedHours : public WriteAttribute { public: WriteBallastConfigurationLampRatedHours() : WriteAttribute("lamp-rated-hours") { AddArgument("attr-name", "lamp-rated-hours"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteBallastConfigurationLampRatedHours() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampRatedHours::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedInt:mValue.Value()]; } [cluster writeAttributeLampRatedHoursWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("BallastConfiguration LampRatedHours write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeBallastConfigurationLampRatedHours : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationLampRatedHours() : SubscribeAttribute("lamp-rated-hours") { } ~SubscribeAttributeBallastConfigurationLampRatedHours() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampRatedHours::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLampRatedHoursWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.LampRatedHours response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LampBurnHours */ class ReadBallastConfigurationLampBurnHours : public ReadAttribute { public: ReadBallastConfigurationLampBurnHours() : ReadAttribute("lamp-burn-hours") { } ~ReadBallastConfigurationLampBurnHours() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampBurnHours::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLampBurnHoursWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.LampBurnHours response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration LampBurnHours read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteBallastConfigurationLampBurnHours : public WriteAttribute { public: WriteBallastConfigurationLampBurnHours() : WriteAttribute("lamp-burn-hours") { AddArgument("attr-name", "lamp-burn-hours"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteBallastConfigurationLampBurnHours() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampBurnHours::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedInt:mValue.Value()]; } [cluster writeAttributeLampBurnHoursWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("BallastConfiguration LampBurnHours write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeBallastConfigurationLampBurnHours : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationLampBurnHours() : SubscribeAttribute("lamp-burn-hours") { } ~SubscribeAttributeBallastConfigurationLampBurnHours() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampBurnHours::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLampBurnHoursWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.LampBurnHours response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LampAlarmMode */ class ReadBallastConfigurationLampAlarmMode : public ReadAttribute { public: ReadBallastConfigurationLampAlarmMode() : ReadAttribute("lamp-alarm-mode") { } ~ReadBallastConfigurationLampAlarmMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampAlarmMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLampAlarmModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.LampAlarmMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration LampAlarmMode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteBallastConfigurationLampAlarmMode : public WriteAttribute { public: WriteBallastConfigurationLampAlarmMode() : WriteAttribute("lamp-alarm-mode") { AddArgument("attr-name", "lamp-alarm-mode"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteBallastConfigurationLampAlarmMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampAlarmMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeLampAlarmModeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("BallastConfiguration LampAlarmMode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeBallastConfigurationLampAlarmMode : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationLampAlarmMode() : SubscribeAttribute("lamp-alarm-mode") { } ~SubscribeAttributeBallastConfigurationLampAlarmMode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampAlarmMode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLampAlarmModeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.LampAlarmMode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LampBurnHoursTripPoint */ class ReadBallastConfigurationLampBurnHoursTripPoint : public ReadAttribute { public: ReadBallastConfigurationLampBurnHoursTripPoint() : ReadAttribute("lamp-burn-hours-trip-point") { } ~ReadBallastConfigurationLampBurnHoursTripPoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampBurnHoursTripPoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLampBurnHoursTripPointWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.LampBurnHoursTripPoint response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration LampBurnHoursTripPoint read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteBallastConfigurationLampBurnHoursTripPoint : public WriteAttribute { public: WriteBallastConfigurationLampBurnHoursTripPoint() : WriteAttribute("lamp-burn-hours-trip-point") { AddArgument("attr-name", "lamp-burn-hours-trip-point"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteBallastConfigurationLampBurnHoursTripPoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampBurnHoursTripPoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedInt:mValue.Value()]; } [cluster writeAttributeLampBurnHoursTripPointWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("BallastConfiguration LampBurnHoursTripPoint write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeBallastConfigurationLampBurnHoursTripPoint : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationLampBurnHoursTripPoint() : SubscribeAttribute("lamp-burn-hours-trip-point") { } ~SubscribeAttributeBallastConfigurationLampBurnHoursTripPoint() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::LampBurnHoursTripPoint::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLampBurnHoursTripPointWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.LampBurnHoursTripPoint response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadBallastConfigurationGeneratedCommandList : public ReadAttribute { public: ReadBallastConfigurationGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadBallastConfigurationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBallastConfigurationGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeBallastConfigurationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadBallastConfigurationAcceptedCommandList : public ReadAttribute { public: ReadBallastConfigurationAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadBallastConfigurationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBallastConfigurationAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeBallastConfigurationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadBallastConfigurationEventList : public ReadAttribute { public: ReadBallastConfigurationEventList() : ReadAttribute("event-list") { } ~ReadBallastConfigurationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBallastConfigurationEventList : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeBallastConfigurationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadBallastConfigurationAttributeList : public ReadAttribute { public: ReadBallastConfigurationAttributeList() : ReadAttribute("attribute-list") { } ~ReadBallastConfigurationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBallastConfigurationAttributeList : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeBallastConfigurationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadBallastConfigurationFeatureMap : public ReadAttribute { public: ReadBallastConfigurationFeatureMap() : ReadAttribute("feature-map") { } ~ReadBallastConfigurationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBallastConfigurationFeatureMap : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeBallastConfigurationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadBallastConfigurationClusterRevision : public ReadAttribute { public: ReadBallastConfigurationClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadBallastConfigurationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("BallastConfiguration ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeBallastConfigurationClusterRevision : public SubscribeAttribute { public: SubscribeAttributeBallastConfigurationClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeBallastConfigurationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::BallastConfiguration::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::BallastConfiguration::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterBallastConfiguration alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BallastConfiguration.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster IlluminanceMeasurement | 0x0400 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MeasuredValue | 0x0000 | | * MinMeasuredValue | 0x0001 | | * MaxMeasuredValue | 0x0002 | | * Tolerance | 0x0003 | | * LightSensorType | 0x0004 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute MeasuredValue */ class ReadIlluminanceMeasurementMeasuredValue : public ReadAttribute { public: ReadIlluminanceMeasurementMeasuredValue() : ReadAttribute("measured-value") { } ~ReadIlluminanceMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("IlluminanceMeasurement MeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIlluminanceMeasurementMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeIlluminanceMeasurementMeasuredValue() : SubscribeAttribute("measured-value") { } ~SubscribeAttributeIlluminanceMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinMeasuredValue */ class ReadIlluminanceMeasurementMinMeasuredValue : public ReadAttribute { public: ReadIlluminanceMeasurementMinMeasuredValue() : ReadAttribute("min-measured-value") { } ~ReadIlluminanceMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("IlluminanceMeasurement MinMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIlluminanceMeasurementMinMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeIlluminanceMeasurementMinMeasuredValue() : SubscribeAttribute("min-measured-value") { } ~SubscribeAttributeIlluminanceMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxMeasuredValue */ class ReadIlluminanceMeasurementMaxMeasuredValue : public ReadAttribute { public: ReadIlluminanceMeasurementMaxMeasuredValue() : ReadAttribute("max-measured-value") { } ~ReadIlluminanceMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("IlluminanceMeasurement MaxMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIlluminanceMeasurementMaxMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeIlluminanceMeasurementMaxMeasuredValue() : SubscribeAttribute("max-measured-value") { } ~SubscribeAttributeIlluminanceMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Tolerance */ class ReadIlluminanceMeasurementTolerance : public ReadAttribute { public: ReadIlluminanceMeasurementTolerance() : ReadAttribute("tolerance") { } ~ReadIlluminanceMeasurementTolerance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::Tolerance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeToleranceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.Tolerance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("IlluminanceMeasurement Tolerance read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIlluminanceMeasurementTolerance : public SubscribeAttribute { public: SubscribeAttributeIlluminanceMeasurementTolerance() : SubscribeAttribute("tolerance") { } ~SubscribeAttributeIlluminanceMeasurementTolerance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::Tolerance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeToleranceWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.Tolerance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LightSensorType */ class ReadIlluminanceMeasurementLightSensorType : public ReadAttribute { public: ReadIlluminanceMeasurementLightSensorType() : ReadAttribute("light-sensor-type") { } ~ReadIlluminanceMeasurementLightSensorType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::LightSensorType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLightSensorTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.LightSensorType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("IlluminanceMeasurement LightSensorType read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIlluminanceMeasurementLightSensorType : public SubscribeAttribute { public: SubscribeAttributeIlluminanceMeasurementLightSensorType() : SubscribeAttribute("light-sensor-type") { } ~SubscribeAttributeIlluminanceMeasurementLightSensorType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::LightSensorType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLightSensorTypeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.LightSensorType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadIlluminanceMeasurementGeneratedCommandList : public ReadAttribute { public: ReadIlluminanceMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadIlluminanceMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("IlluminanceMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIlluminanceMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeIlluminanceMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeIlluminanceMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadIlluminanceMeasurementAcceptedCommandList : public ReadAttribute { public: ReadIlluminanceMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadIlluminanceMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("IlluminanceMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIlluminanceMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeIlluminanceMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeIlluminanceMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadIlluminanceMeasurementEventList : public ReadAttribute { public: ReadIlluminanceMeasurementEventList() : ReadAttribute("event-list") { } ~ReadIlluminanceMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("IlluminanceMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIlluminanceMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributeIlluminanceMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeIlluminanceMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadIlluminanceMeasurementAttributeList : public ReadAttribute { public: ReadIlluminanceMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadIlluminanceMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("IlluminanceMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIlluminanceMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributeIlluminanceMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeIlluminanceMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadIlluminanceMeasurementFeatureMap : public ReadAttribute { public: ReadIlluminanceMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadIlluminanceMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("IlluminanceMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIlluminanceMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeIlluminanceMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeIlluminanceMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadIlluminanceMeasurementClusterRevision : public ReadAttribute { public: ReadIlluminanceMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadIlluminanceMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("IlluminanceMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeIlluminanceMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeIlluminanceMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeIlluminanceMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::IlluminanceMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::IlluminanceMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterIlluminanceMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster TemperatureMeasurement | 0x0402 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MeasuredValue | 0x0000 | | * MinMeasuredValue | 0x0001 | | * MaxMeasuredValue | 0x0002 | | * Tolerance | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute MeasuredValue */ class ReadTemperatureMeasurementMeasuredValue : public ReadAttribute { public: ReadTemperatureMeasurementMeasuredValue() : ReadAttribute("measured-value") { } ~ReadTemperatureMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureMeasurement MeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureMeasurementMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeTemperatureMeasurementMeasuredValue() : SubscribeAttribute("measured-value") { } ~SubscribeAttributeTemperatureMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinMeasuredValue */ class ReadTemperatureMeasurementMinMeasuredValue : public ReadAttribute { public: ReadTemperatureMeasurementMinMeasuredValue() : ReadAttribute("min-measured-value") { } ~ReadTemperatureMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureMeasurement MinMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureMeasurementMinMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeTemperatureMeasurementMinMeasuredValue() : SubscribeAttribute("min-measured-value") { } ~SubscribeAttributeTemperatureMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxMeasuredValue */ class ReadTemperatureMeasurementMaxMeasuredValue : public ReadAttribute { public: ReadTemperatureMeasurementMaxMeasuredValue() : ReadAttribute("max-measured-value") { } ~ReadTemperatureMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureMeasurement MaxMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureMeasurementMaxMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeTemperatureMeasurementMaxMeasuredValue() : SubscribeAttribute("max-measured-value") { } ~SubscribeAttributeTemperatureMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Tolerance */ class ReadTemperatureMeasurementTolerance : public ReadAttribute { public: ReadTemperatureMeasurementTolerance() : ReadAttribute("tolerance") { } ~ReadTemperatureMeasurementTolerance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::Tolerance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeToleranceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.Tolerance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureMeasurement Tolerance read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureMeasurementTolerance : public SubscribeAttribute { public: SubscribeAttributeTemperatureMeasurementTolerance() : SubscribeAttribute("tolerance") { } ~SubscribeAttributeTemperatureMeasurementTolerance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::Tolerance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeToleranceWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.Tolerance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadTemperatureMeasurementGeneratedCommandList : public ReadAttribute { public: ReadTemperatureMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadTemperatureMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeTemperatureMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeTemperatureMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadTemperatureMeasurementAcceptedCommandList : public ReadAttribute { public: ReadTemperatureMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadTemperatureMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeTemperatureMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeTemperatureMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadTemperatureMeasurementEventList : public ReadAttribute { public: ReadTemperatureMeasurementEventList() : ReadAttribute("event-list") { } ~ReadTemperatureMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributeTemperatureMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeTemperatureMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadTemperatureMeasurementAttributeList : public ReadAttribute { public: ReadTemperatureMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadTemperatureMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributeTemperatureMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeTemperatureMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadTemperatureMeasurementFeatureMap : public ReadAttribute { public: ReadTemperatureMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadTemperatureMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeTemperatureMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeTemperatureMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadTemperatureMeasurementClusterRevision : public ReadAttribute { public: ReadTemperatureMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadTemperatureMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TemperatureMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTemperatureMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeTemperatureMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeTemperatureMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TemperatureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TemperatureMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTemperatureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster PressureMeasurement | 0x0403 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MeasuredValue | 0x0000 | | * MinMeasuredValue | 0x0001 | | * MaxMeasuredValue | 0x0002 | | * Tolerance | 0x0003 | | * ScaledValue | 0x0010 | | * MinScaledValue | 0x0011 | | * MaxScaledValue | 0x0012 | | * ScaledTolerance | 0x0013 | | * Scale | 0x0014 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute MeasuredValue */ class ReadPressureMeasurementMeasuredValue : public ReadAttribute { public: ReadPressureMeasurementMeasuredValue() : ReadAttribute("measured-value") { } ~ReadPressureMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PressureMeasurement MeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePressureMeasurementMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePressureMeasurementMeasuredValue() : SubscribeAttribute("measured-value") { } ~SubscribeAttributePressureMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinMeasuredValue */ class ReadPressureMeasurementMinMeasuredValue : public ReadAttribute { public: ReadPressureMeasurementMinMeasuredValue() : ReadAttribute("min-measured-value") { } ~ReadPressureMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PressureMeasurement MinMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePressureMeasurementMinMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePressureMeasurementMinMeasuredValue() : SubscribeAttribute("min-measured-value") { } ~SubscribeAttributePressureMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxMeasuredValue */ class ReadPressureMeasurementMaxMeasuredValue : public ReadAttribute { public: ReadPressureMeasurementMaxMeasuredValue() : ReadAttribute("max-measured-value") { } ~ReadPressureMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PressureMeasurement MaxMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePressureMeasurementMaxMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePressureMeasurementMaxMeasuredValue() : SubscribeAttribute("max-measured-value") { } ~SubscribeAttributePressureMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Tolerance */ class ReadPressureMeasurementTolerance : public ReadAttribute { public: ReadPressureMeasurementTolerance() : ReadAttribute("tolerance") { } ~ReadPressureMeasurementTolerance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::Tolerance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeToleranceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.Tolerance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PressureMeasurement Tolerance read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePressureMeasurementTolerance : public SubscribeAttribute { public: SubscribeAttributePressureMeasurementTolerance() : SubscribeAttribute("tolerance") { } ~SubscribeAttributePressureMeasurementTolerance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::Tolerance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeToleranceWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.Tolerance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ScaledValue */ class ReadPressureMeasurementScaledValue : public ReadAttribute { public: ReadPressureMeasurementScaledValue() : ReadAttribute("scaled-value") { } ~ReadPressureMeasurementScaledValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::ScaledValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeScaledValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.ScaledValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PressureMeasurement ScaledValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePressureMeasurementScaledValue : public SubscribeAttribute { public: SubscribeAttributePressureMeasurementScaledValue() : SubscribeAttribute("scaled-value") { } ~SubscribeAttributePressureMeasurementScaledValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::ScaledValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeScaledValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.ScaledValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinScaledValue */ class ReadPressureMeasurementMinScaledValue : public ReadAttribute { public: ReadPressureMeasurementMinScaledValue() : ReadAttribute("min-scaled-value") { } ~ReadPressureMeasurementMinScaledValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::MinScaledValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinScaledValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.MinScaledValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PressureMeasurement MinScaledValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePressureMeasurementMinScaledValue : public SubscribeAttribute { public: SubscribeAttributePressureMeasurementMinScaledValue() : SubscribeAttribute("min-scaled-value") { } ~SubscribeAttributePressureMeasurementMinScaledValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::MinScaledValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinScaledValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.MinScaledValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxScaledValue */ class ReadPressureMeasurementMaxScaledValue : public ReadAttribute { public: ReadPressureMeasurementMaxScaledValue() : ReadAttribute("max-scaled-value") { } ~ReadPressureMeasurementMaxScaledValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::MaxScaledValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxScaledValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.MaxScaledValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PressureMeasurement MaxScaledValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePressureMeasurementMaxScaledValue : public SubscribeAttribute { public: SubscribeAttributePressureMeasurementMaxScaledValue() : SubscribeAttribute("max-scaled-value") { } ~SubscribeAttributePressureMeasurementMaxScaledValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::MaxScaledValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxScaledValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.MaxScaledValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ScaledTolerance */ class ReadPressureMeasurementScaledTolerance : public ReadAttribute { public: ReadPressureMeasurementScaledTolerance() : ReadAttribute("scaled-tolerance") { } ~ReadPressureMeasurementScaledTolerance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::ScaledTolerance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeScaledToleranceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.ScaledTolerance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PressureMeasurement ScaledTolerance read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePressureMeasurementScaledTolerance : public SubscribeAttribute { public: SubscribeAttributePressureMeasurementScaledTolerance() : SubscribeAttribute("scaled-tolerance") { } ~SubscribeAttributePressureMeasurementScaledTolerance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::ScaledTolerance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeScaledToleranceWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.ScaledTolerance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Scale */ class ReadPressureMeasurementScale : public ReadAttribute { public: ReadPressureMeasurementScale() : ReadAttribute("scale") { } ~ReadPressureMeasurementScale() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::Scale::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeScaleWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.Scale response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PressureMeasurement Scale read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePressureMeasurementScale : public SubscribeAttribute { public: SubscribeAttributePressureMeasurementScale() : SubscribeAttribute("scale") { } ~SubscribeAttributePressureMeasurementScale() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::Scale::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeScaleWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.Scale response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadPressureMeasurementGeneratedCommandList : public ReadAttribute { public: ReadPressureMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadPressureMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PressureMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePressureMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributePressureMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributePressureMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadPressureMeasurementAcceptedCommandList : public ReadAttribute { public: ReadPressureMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadPressureMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PressureMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePressureMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributePressureMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributePressureMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadPressureMeasurementEventList : public ReadAttribute { public: ReadPressureMeasurementEventList() : ReadAttribute("event-list") { } ~ReadPressureMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PressureMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePressureMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributePressureMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributePressureMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadPressureMeasurementAttributeList : public ReadAttribute { public: ReadPressureMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadPressureMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PressureMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePressureMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributePressureMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributePressureMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadPressureMeasurementFeatureMap : public ReadAttribute { public: ReadPressureMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadPressureMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PressureMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePressureMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributePressureMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributePressureMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadPressureMeasurementClusterRevision : public ReadAttribute { public: ReadPressureMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadPressureMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PressureMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePressureMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributePressureMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributePressureMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::PressureMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::PressureMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPressureMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster FlowMeasurement | 0x0404 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MeasuredValue | 0x0000 | | * MinMeasuredValue | 0x0001 | | * MaxMeasuredValue | 0x0002 | | * Tolerance | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute MeasuredValue */ class ReadFlowMeasurementMeasuredValue : public ReadAttribute { public: ReadFlowMeasurementMeasuredValue() : ReadAttribute("measured-value") { } ~ReadFlowMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FlowMeasurement MeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFlowMeasurementMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeFlowMeasurementMeasuredValue() : SubscribeAttribute("measured-value") { } ~SubscribeAttributeFlowMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinMeasuredValue */ class ReadFlowMeasurementMinMeasuredValue : public ReadAttribute { public: ReadFlowMeasurementMinMeasuredValue() : ReadAttribute("min-measured-value") { } ~ReadFlowMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FlowMeasurement MinMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFlowMeasurementMinMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeFlowMeasurementMinMeasuredValue() : SubscribeAttribute("min-measured-value") { } ~SubscribeAttributeFlowMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxMeasuredValue */ class ReadFlowMeasurementMaxMeasuredValue : public ReadAttribute { public: ReadFlowMeasurementMaxMeasuredValue() : ReadAttribute("max-measured-value") { } ~ReadFlowMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FlowMeasurement MaxMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFlowMeasurementMaxMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeFlowMeasurementMaxMeasuredValue() : SubscribeAttribute("max-measured-value") { } ~SubscribeAttributeFlowMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Tolerance */ class ReadFlowMeasurementTolerance : public ReadAttribute { public: ReadFlowMeasurementTolerance() : ReadAttribute("tolerance") { } ~ReadFlowMeasurementTolerance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::Tolerance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeToleranceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.Tolerance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FlowMeasurement Tolerance read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFlowMeasurementTolerance : public SubscribeAttribute { public: SubscribeAttributeFlowMeasurementTolerance() : SubscribeAttribute("tolerance") { } ~SubscribeAttributeFlowMeasurementTolerance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::Tolerance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeToleranceWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.Tolerance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadFlowMeasurementGeneratedCommandList : public ReadAttribute { public: ReadFlowMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadFlowMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FlowMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFlowMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeFlowMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeFlowMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadFlowMeasurementAcceptedCommandList : public ReadAttribute { public: ReadFlowMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadFlowMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FlowMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFlowMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeFlowMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeFlowMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadFlowMeasurementEventList : public ReadAttribute { public: ReadFlowMeasurementEventList() : ReadAttribute("event-list") { } ~ReadFlowMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FlowMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFlowMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributeFlowMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeFlowMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadFlowMeasurementAttributeList : public ReadAttribute { public: ReadFlowMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadFlowMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FlowMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFlowMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributeFlowMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeFlowMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadFlowMeasurementFeatureMap : public ReadAttribute { public: ReadFlowMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadFlowMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FlowMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFlowMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeFlowMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeFlowMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadFlowMeasurementClusterRevision : public ReadAttribute { public: ReadFlowMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadFlowMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FlowMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFlowMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeFlowMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeFlowMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FlowMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FlowMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFlowMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster RelativeHumidityMeasurement | 0x0405 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MeasuredValue | 0x0000 | | * MinMeasuredValue | 0x0001 | | * MaxMeasuredValue | 0x0002 | | * Tolerance | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute MeasuredValue */ class ReadRelativeHumidityMeasurementMeasuredValue : public ReadAttribute { public: ReadRelativeHumidityMeasurementMeasuredValue() : ReadAttribute("measured-value") { } ~ReadRelativeHumidityMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RelativeHumidityMeasurement MeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRelativeHumidityMeasurementMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeRelativeHumidityMeasurementMeasuredValue() : SubscribeAttribute("measured-value") { } ~SubscribeAttributeRelativeHumidityMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinMeasuredValue */ class ReadRelativeHumidityMeasurementMinMeasuredValue : public ReadAttribute { public: ReadRelativeHumidityMeasurementMinMeasuredValue() : ReadAttribute("min-measured-value") { } ~ReadRelativeHumidityMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RelativeHumidityMeasurement MinMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRelativeHumidityMeasurementMinMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeRelativeHumidityMeasurementMinMeasuredValue() : SubscribeAttribute("min-measured-value") { } ~SubscribeAttributeRelativeHumidityMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxMeasuredValue */ class ReadRelativeHumidityMeasurementMaxMeasuredValue : public ReadAttribute { public: ReadRelativeHumidityMeasurementMaxMeasuredValue() : ReadAttribute("max-measured-value") { } ~ReadRelativeHumidityMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RelativeHumidityMeasurement MaxMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRelativeHumidityMeasurementMaxMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeRelativeHumidityMeasurementMaxMeasuredValue() : SubscribeAttribute("max-measured-value") { } ~SubscribeAttributeRelativeHumidityMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Tolerance */ class ReadRelativeHumidityMeasurementTolerance : public ReadAttribute { public: ReadRelativeHumidityMeasurementTolerance() : ReadAttribute("tolerance") { } ~ReadRelativeHumidityMeasurementTolerance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::Tolerance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeToleranceWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.Tolerance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RelativeHumidityMeasurement Tolerance read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRelativeHumidityMeasurementTolerance : public SubscribeAttribute { public: SubscribeAttributeRelativeHumidityMeasurementTolerance() : SubscribeAttribute("tolerance") { } ~SubscribeAttributeRelativeHumidityMeasurementTolerance() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::Tolerance::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeToleranceWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.Tolerance response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadRelativeHumidityMeasurementGeneratedCommandList : public ReadAttribute { public: ReadRelativeHumidityMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadRelativeHumidityMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RelativeHumidityMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRelativeHumidityMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeRelativeHumidityMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeRelativeHumidityMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadRelativeHumidityMeasurementAcceptedCommandList : public ReadAttribute { public: ReadRelativeHumidityMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadRelativeHumidityMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RelativeHumidityMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRelativeHumidityMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeRelativeHumidityMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeRelativeHumidityMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadRelativeHumidityMeasurementEventList : public ReadAttribute { public: ReadRelativeHumidityMeasurementEventList() : ReadAttribute("event-list") { } ~ReadRelativeHumidityMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RelativeHumidityMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRelativeHumidityMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributeRelativeHumidityMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeRelativeHumidityMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadRelativeHumidityMeasurementAttributeList : public ReadAttribute { public: ReadRelativeHumidityMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadRelativeHumidityMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RelativeHumidityMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRelativeHumidityMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributeRelativeHumidityMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeRelativeHumidityMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadRelativeHumidityMeasurementFeatureMap : public ReadAttribute { public: ReadRelativeHumidityMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadRelativeHumidityMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RelativeHumidityMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRelativeHumidityMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeRelativeHumidityMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeRelativeHumidityMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadRelativeHumidityMeasurementClusterRevision : public ReadAttribute { public: ReadRelativeHumidityMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadRelativeHumidityMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RelativeHumidityMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRelativeHumidityMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeRelativeHumidityMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeRelativeHumidityMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RelativeHumidityMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RelativeHumidityMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRelativeHumidityMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster OccupancySensing | 0x0406 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * Occupancy | 0x0000 | | * OccupancySensorType | 0x0001 | | * OccupancySensorTypeBitmap | 0x0002 | | * HoldTime | 0x0003 | | * HoldTimeLimits | 0x0004 | | * PIROccupiedToUnoccupiedDelay | 0x0010 | | * PIRUnoccupiedToOccupiedDelay | 0x0011 | | * PIRUnoccupiedToOccupiedThreshold | 0x0012 | | * UltrasonicOccupiedToUnoccupiedDelay | 0x0020 | | * UltrasonicUnoccupiedToOccupiedDelay | 0x0021 | | * UltrasonicUnoccupiedToOccupiedThreshold | 0x0022 | | * PhysicalContactOccupiedToUnoccupiedDelay | 0x0030 | | * PhysicalContactUnoccupiedToOccupiedDelay | 0x0031 | | * PhysicalContactUnoccupiedToOccupiedThreshold | 0x0032 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * OccupancyChanged | 0x0000 | \*----------------------------------------------------------------------------*/ /* * Attribute Occupancy */ class ReadOccupancySensingOccupancy : public ReadAttribute { public: ReadOccupancySensingOccupancy() : ReadAttribute("occupancy") { } ~ReadOccupancySensingOccupancy() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::Occupancy::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOccupancyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.Occupancy response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing Occupancy read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOccupancySensingOccupancy : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingOccupancy() : SubscribeAttribute("occupancy") { } ~SubscribeAttributeOccupancySensingOccupancy() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::Occupancy::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOccupancyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.Occupancy response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OccupancySensorType */ class ReadOccupancySensingOccupancySensorType : public ReadAttribute { public: ReadOccupancySensingOccupancySensorType() : ReadAttribute("occupancy-sensor-type") { } ~ReadOccupancySensingOccupancySensorType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::OccupancySensorType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOccupancySensorTypeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.OccupancySensorType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing OccupancySensorType read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOccupancySensingOccupancySensorType : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingOccupancySensorType() : SubscribeAttribute("occupancy-sensor-type") { } ~SubscribeAttributeOccupancySensingOccupancySensorType() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::OccupancySensorType::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOccupancySensorTypeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.OccupancySensorType response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OccupancySensorTypeBitmap */ class ReadOccupancySensingOccupancySensorTypeBitmap : public ReadAttribute { public: ReadOccupancySensingOccupancySensorTypeBitmap() : ReadAttribute("occupancy-sensor-type-bitmap") { } ~ReadOccupancySensingOccupancySensorTypeBitmap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::OccupancySensorTypeBitmap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOccupancySensorTypeBitmapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.OccupancySensorTypeBitmap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing OccupancySensorTypeBitmap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOccupancySensingOccupancySensorTypeBitmap : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingOccupancySensorTypeBitmap() : SubscribeAttribute("occupancy-sensor-type-bitmap") { } ~SubscribeAttributeOccupancySensingOccupancySensorTypeBitmap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::OccupancySensorTypeBitmap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOccupancySensorTypeBitmapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.OccupancySensorTypeBitmap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute HoldTime */ class ReadOccupancySensingHoldTime : public ReadAttribute { public: ReadOccupancySensingHoldTime() : ReadAttribute("hold-time") { } ~ReadOccupancySensingHoldTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::HoldTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeHoldTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.HoldTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing HoldTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteOccupancySensingHoldTime : public WriteAttribute { public: WriteOccupancySensingHoldTime() : WriteAttribute("hold-time") { AddArgument("attr-name", "hold-time"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteOccupancySensingHoldTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::HoldTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeHoldTimeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("OccupancySensing HoldTime write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeOccupancySensingHoldTime : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingHoldTime() : SubscribeAttribute("hold-time") { } ~SubscribeAttributeOccupancySensingHoldTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::HoldTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeHoldTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.HoldTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute HoldTimeLimits */ class ReadOccupancySensingHoldTimeLimits : public ReadAttribute { public: ReadOccupancySensingHoldTimeLimits() : ReadAttribute("hold-time-limits") { } ~ReadOccupancySensingHoldTimeLimits() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::HoldTimeLimits::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeHoldTimeLimitsWithCompletion:^(MTROccupancySensingClusterHoldTimeLimitsStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.HoldTimeLimits response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing HoldTimeLimits read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOccupancySensingHoldTimeLimits : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingHoldTimeLimits() : SubscribeAttribute("hold-time-limits") { } ~SubscribeAttributeOccupancySensingHoldTimeLimits() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::HoldTimeLimits::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeHoldTimeLimitsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTROccupancySensingClusterHoldTimeLimitsStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.HoldTimeLimits response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute PIROccupiedToUnoccupiedDelay */ class ReadOccupancySensingPIROccupiedToUnoccupiedDelay : public ReadAttribute { public: ReadOccupancySensingPIROccupiedToUnoccupiedDelay() : ReadAttribute("piroccupied-to-unoccupied-delay") { } ~ReadOccupancySensingPIROccupiedToUnoccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PIROccupiedToUnoccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePIROccupiedToUnoccupiedDelayWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.PIROccupiedToUnoccupiedDelay response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing PIROccupiedToUnoccupiedDelay read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteOccupancySensingPIROccupiedToUnoccupiedDelay : public WriteAttribute { public: WriteOccupancySensingPIROccupiedToUnoccupiedDelay() : WriteAttribute("piroccupied-to-unoccupied-delay") { AddArgument("attr-name", "piroccupied-to-unoccupied-delay"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteOccupancySensingPIROccupiedToUnoccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PIROccupiedToUnoccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributePIROccupiedToUnoccupiedDelayWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("OccupancySensing PIROccupiedToUnoccupiedDelay write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeOccupancySensingPIROccupiedToUnoccupiedDelay : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingPIROccupiedToUnoccupiedDelay() : SubscribeAttribute("piroccupied-to-unoccupied-delay") { } ~SubscribeAttributeOccupancySensingPIROccupiedToUnoccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PIROccupiedToUnoccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePIROccupiedToUnoccupiedDelayWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.PIROccupiedToUnoccupiedDelay response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PIRUnoccupiedToOccupiedDelay */ class ReadOccupancySensingPIRUnoccupiedToOccupiedDelay : public ReadAttribute { public: ReadOccupancySensingPIRUnoccupiedToOccupiedDelay() : ReadAttribute("pirunoccupied-to-occupied-delay") { } ~ReadOccupancySensingPIRUnoccupiedToOccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PIRUnoccupiedToOccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePIRUnoccupiedToOccupiedDelayWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.PIRUnoccupiedToOccupiedDelay response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing PIRUnoccupiedToOccupiedDelay read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteOccupancySensingPIRUnoccupiedToOccupiedDelay : public WriteAttribute { public: WriteOccupancySensingPIRUnoccupiedToOccupiedDelay() : WriteAttribute("pirunoccupied-to-occupied-delay") { AddArgument("attr-name", "pirunoccupied-to-occupied-delay"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteOccupancySensingPIRUnoccupiedToOccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PIRUnoccupiedToOccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributePIRUnoccupiedToOccupiedDelayWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("OccupancySensing PIRUnoccupiedToOccupiedDelay write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeOccupancySensingPIRUnoccupiedToOccupiedDelay : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingPIRUnoccupiedToOccupiedDelay() : SubscribeAttribute("pirunoccupied-to-occupied-delay") { } ~SubscribeAttributeOccupancySensingPIRUnoccupiedToOccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PIRUnoccupiedToOccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePIRUnoccupiedToOccupiedDelayWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.PIRUnoccupiedToOccupiedDelay response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PIRUnoccupiedToOccupiedThreshold */ class ReadOccupancySensingPIRUnoccupiedToOccupiedThreshold : public ReadAttribute { public: ReadOccupancySensingPIRUnoccupiedToOccupiedThreshold() : ReadAttribute("pirunoccupied-to-occupied-threshold") { } ~ReadOccupancySensingPIRUnoccupiedToOccupiedThreshold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PIRUnoccupiedToOccupiedThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePIRUnoccupiedToOccupiedThresholdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.PIRUnoccupiedToOccupiedThreshold response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing PIRUnoccupiedToOccupiedThreshold read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteOccupancySensingPIRUnoccupiedToOccupiedThreshold : public WriteAttribute { public: WriteOccupancySensingPIRUnoccupiedToOccupiedThreshold() : WriteAttribute("pirunoccupied-to-occupied-threshold") { AddArgument("attr-name", "pirunoccupied-to-occupied-threshold"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteOccupancySensingPIRUnoccupiedToOccupiedThreshold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PIRUnoccupiedToOccupiedThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributePIRUnoccupiedToOccupiedThresholdWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("OccupancySensing PIRUnoccupiedToOccupiedThreshold write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeOccupancySensingPIRUnoccupiedToOccupiedThreshold : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingPIRUnoccupiedToOccupiedThreshold() : SubscribeAttribute("pirunoccupied-to-occupied-threshold") { } ~SubscribeAttributeOccupancySensingPIRUnoccupiedToOccupiedThreshold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PIRUnoccupiedToOccupiedThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePIRUnoccupiedToOccupiedThresholdWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.PIRUnoccupiedToOccupiedThreshold response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute UltrasonicOccupiedToUnoccupiedDelay */ class ReadOccupancySensingUltrasonicOccupiedToUnoccupiedDelay : public ReadAttribute { public: ReadOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() : ReadAttribute("ultrasonic-occupied-to-unoccupied-delay") { } ~ReadOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::UltrasonicOccupiedToUnoccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUltrasonicOccupiedToUnoccupiedDelayWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.UltrasonicOccupiedToUnoccupiedDelay response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing UltrasonicOccupiedToUnoccupiedDelay read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteOccupancySensingUltrasonicOccupiedToUnoccupiedDelay : public WriteAttribute { public: WriteOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() : WriteAttribute("ultrasonic-occupied-to-unoccupied-delay") { AddArgument("attr-name", "ultrasonic-occupied-to-unoccupied-delay"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::UltrasonicOccupiedToUnoccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeUltrasonicOccupiedToUnoccupiedDelayWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("OccupancySensing UltrasonicOccupiedToUnoccupiedDelay write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeOccupancySensingUltrasonicOccupiedToUnoccupiedDelay : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() : SubscribeAttribute("ultrasonic-occupied-to-unoccupied-delay") { } ~SubscribeAttributeOccupancySensingUltrasonicOccupiedToUnoccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::UltrasonicOccupiedToUnoccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUltrasonicOccupiedToUnoccupiedDelayWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.UltrasonicOccupiedToUnoccupiedDelay response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute UltrasonicUnoccupiedToOccupiedDelay */ class ReadOccupancySensingUltrasonicUnoccupiedToOccupiedDelay : public ReadAttribute { public: ReadOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() : ReadAttribute("ultrasonic-unoccupied-to-occupied-delay") { } ~ReadOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::UltrasonicUnoccupiedToOccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUltrasonicUnoccupiedToOccupiedDelayWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.UltrasonicUnoccupiedToOccupiedDelay response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing UltrasonicUnoccupiedToOccupiedDelay read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteOccupancySensingUltrasonicUnoccupiedToOccupiedDelay : public WriteAttribute { public: WriteOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() : WriteAttribute("ultrasonic-unoccupied-to-occupied-delay") { AddArgument("attr-name", "ultrasonic-unoccupied-to-occupied-delay"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::UltrasonicUnoccupiedToOccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeUltrasonicUnoccupiedToOccupiedDelayWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("OccupancySensing UltrasonicUnoccupiedToOccupiedDelay write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedDelay : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() : SubscribeAttribute("ultrasonic-unoccupied-to-occupied-delay") { } ~SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::UltrasonicUnoccupiedToOccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUltrasonicUnoccupiedToOccupiedDelayWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.UltrasonicUnoccupiedToOccupiedDelay response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute UltrasonicUnoccupiedToOccupiedThreshold */ class ReadOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold : public ReadAttribute { public: ReadOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() : ReadAttribute("ultrasonic-unoccupied-to-occupied-threshold") { } ~ReadOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::UltrasonicUnoccupiedToOccupiedThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUltrasonicUnoccupiedToOccupiedThresholdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.UltrasonicUnoccupiedToOccupiedThreshold response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing UltrasonicUnoccupiedToOccupiedThreshold read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold : public WriteAttribute { public: WriteOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() : WriteAttribute("ultrasonic-unoccupied-to-occupied-threshold") { AddArgument("attr-name", "ultrasonic-unoccupied-to-occupied-threshold"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::UltrasonicUnoccupiedToOccupiedThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeUltrasonicUnoccupiedToOccupiedThresholdWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("OccupancySensing UltrasonicUnoccupiedToOccupiedThreshold write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() : SubscribeAttribute("ultrasonic-unoccupied-to-occupied-threshold") { } ~SubscribeAttributeOccupancySensingUltrasonicUnoccupiedToOccupiedThreshold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::UltrasonicUnoccupiedToOccupiedThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUltrasonicUnoccupiedToOccupiedThresholdWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.UltrasonicUnoccupiedToOccupiedThreshold response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PhysicalContactOccupiedToUnoccupiedDelay */ class ReadOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay : public ReadAttribute { public: ReadOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() : ReadAttribute("physical-contact-occupied-to-unoccupied-delay") { } ~ReadOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PhysicalContactOccupiedToUnoccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePhysicalContactOccupiedToUnoccupiedDelayWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.PhysicalContactOccupiedToUnoccupiedDelay response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing PhysicalContactOccupiedToUnoccupiedDelay read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay : public WriteAttribute { public: WriteOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() : WriteAttribute("physical-contact-occupied-to-unoccupied-delay") { AddArgument("attr-name", "physical-contact-occupied-to-unoccupied-delay"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PhysicalContactOccupiedToUnoccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributePhysicalContactOccupiedToUnoccupiedDelayWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("OccupancySensing PhysicalContactOccupiedToUnoccupiedDelay write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() : SubscribeAttribute("physical-contact-occupied-to-unoccupied-delay") { } ~SubscribeAttributeOccupancySensingPhysicalContactOccupiedToUnoccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PhysicalContactOccupiedToUnoccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePhysicalContactOccupiedToUnoccupiedDelayWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.PhysicalContactOccupiedToUnoccupiedDelay response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PhysicalContactUnoccupiedToOccupiedDelay */ class ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay : public ReadAttribute { public: ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() : ReadAttribute("physical-contact-unoccupied-to-occupied-delay") { } ~ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PhysicalContactUnoccupiedToOccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePhysicalContactUnoccupiedToOccupiedDelayWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.PhysicalContactUnoccupiedToOccupiedDelay response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing PhysicalContactUnoccupiedToOccupiedDelay read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay : public WriteAttribute { public: WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() : WriteAttribute("physical-contact-unoccupied-to-occupied-delay") { AddArgument("attr-name", "physical-contact-unoccupied-to-occupied-delay"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PhysicalContactUnoccupiedToOccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributePhysicalContactUnoccupiedToOccupiedDelayWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("OccupancySensing PhysicalContactUnoccupiedToOccupiedDelay write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() : SubscribeAttribute("physical-contact-unoccupied-to-occupied-delay") { } ~SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedDelay() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PhysicalContactUnoccupiedToOccupiedDelay::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePhysicalContactUnoccupiedToOccupiedDelayWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.PhysicalContactUnoccupiedToOccupiedDelay response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PhysicalContactUnoccupiedToOccupiedThreshold */ class ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold : public ReadAttribute { public: ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() : ReadAttribute("physical-contact-unoccupied-to-occupied-threshold") { } ~ReadOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PhysicalContactUnoccupiedToOccupiedThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePhysicalContactUnoccupiedToOccupiedThresholdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.PhysicalContactUnoccupiedToOccupiedThreshold response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing PhysicalContactUnoccupiedToOccupiedThreshold read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold : public WriteAttribute { public: WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() : WriteAttribute("physical-contact-unoccupied-to-occupied-threshold") { AddArgument("attr-name", "physical-contact-unoccupied-to-occupied-threshold"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PhysicalContactUnoccupiedToOccupiedThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributePhysicalContactUnoccupiedToOccupiedThresholdWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("OccupancySensing PhysicalContactUnoccupiedToOccupiedThreshold write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() : SubscribeAttribute("physical-contact-unoccupied-to-occupied-threshold") { } ~SubscribeAttributeOccupancySensingPhysicalContactUnoccupiedToOccupiedThreshold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::PhysicalContactUnoccupiedToOccupiedThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePhysicalContactUnoccupiedToOccupiedThresholdWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.PhysicalContactUnoccupiedToOccupiedThreshold response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadOccupancySensingGeneratedCommandList : public ReadAttribute { public: ReadOccupancySensingGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadOccupancySensingGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOccupancySensingGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeOccupancySensingGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadOccupancySensingAcceptedCommandList : public ReadAttribute { public: ReadOccupancySensingAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadOccupancySensingAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOccupancySensingAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeOccupancySensingAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadOccupancySensingEventList : public ReadAttribute { public: ReadOccupancySensingEventList() : ReadAttribute("event-list") { } ~ReadOccupancySensingEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOccupancySensingEventList : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeOccupancySensingEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadOccupancySensingAttributeList : public ReadAttribute { public: ReadOccupancySensingAttributeList() : ReadAttribute("attribute-list") { } ~ReadOccupancySensingAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOccupancySensingAttributeList : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeOccupancySensingAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadOccupancySensingFeatureMap : public ReadAttribute { public: ReadOccupancySensingFeatureMap() : ReadAttribute("feature-map") { } ~ReadOccupancySensingFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOccupancySensingFeatureMap : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeOccupancySensingFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadOccupancySensingClusterRevision : public ReadAttribute { public: ReadOccupancySensingClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadOccupancySensingClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OccupancySensing::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OccupancySensing ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOccupancySensingClusterRevision : public SubscribeAttribute { public: SubscribeAttributeOccupancySensingClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeOccupancySensingClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OccupancySensing::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OccupancySensing::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOccupancySensing alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster CarbonMonoxideConcentrationMeasurement | 0x040C | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MeasuredValue | 0x0000 | | * MinMeasuredValue | 0x0001 | | * MaxMeasuredValue | 0x0002 | | * PeakMeasuredValue | 0x0003 | | * PeakMeasuredValueWindow | 0x0004 | | * AverageMeasuredValue | 0x0005 | | * AverageMeasuredValueWindow | 0x0006 | | * Uncertainty | 0x0007 | | * MeasurementUnit | 0x0008 | | * MeasurementMedium | 0x0009 | | * LevelValue | 0x000A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute MeasuredValue */ class ReadCarbonMonoxideConcentrationMeasurementMeasuredValue : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementMeasuredValue() : ReadAttribute("measured-value") { } ~ReadCarbonMonoxideConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement MeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementMeasuredValue() : SubscribeAttribute("measured-value") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinMeasuredValue */ class ReadCarbonMonoxideConcentrationMeasurementMinMeasuredValue : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementMinMeasuredValue() : ReadAttribute("min-measured-value") { } ~ReadCarbonMonoxideConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement MinMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementMinMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementMinMeasuredValue() : SubscribeAttribute("min-measured-value") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxMeasuredValue */ class ReadCarbonMonoxideConcentrationMeasurementMaxMeasuredValue : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementMaxMeasuredValue() : ReadAttribute("max-measured-value") { } ~ReadCarbonMonoxideConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement MaxMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementMaxMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementMaxMeasuredValue() : SubscribeAttribute("max-measured-value") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValue */ class ReadCarbonMonoxideConcentrationMeasurementPeakMeasuredValue : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementPeakMeasuredValue() : ReadAttribute("peak-measured-value") { } ~ReadCarbonMonoxideConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement PeakMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementPeakMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementPeakMeasuredValue() : SubscribeAttribute("peak-measured-value") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValueWindow */ class ReadCarbonMonoxideConcentrationMeasurementPeakMeasuredValueWindow : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementPeakMeasuredValueWindow() : ReadAttribute("peak-measured-value-window") { } ~ReadCarbonMonoxideConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement PeakMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementPeakMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementPeakMeasuredValueWindow() : SubscribeAttribute("peak-measured-value-window") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValue */ class ReadCarbonMonoxideConcentrationMeasurementAverageMeasuredValue : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementAverageMeasuredValue() : ReadAttribute("average-measured-value") { } ~ReadCarbonMonoxideConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement AverageMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementAverageMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementAverageMeasuredValue() : SubscribeAttribute("average-measured-value") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValueWindow */ class ReadCarbonMonoxideConcentrationMeasurementAverageMeasuredValueWindow : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementAverageMeasuredValueWindow() : ReadAttribute("average-measured-value-window") { } ~ReadCarbonMonoxideConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement AverageMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementAverageMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementAverageMeasuredValueWindow() : SubscribeAttribute("average-measured-value-window") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Uncertainty */ class ReadCarbonMonoxideConcentrationMeasurementUncertainty : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementUncertainty() : ReadAttribute("uncertainty") { } ~ReadCarbonMonoxideConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUncertaintyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement Uncertainty read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementUncertainty : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementUncertainty() : SubscribeAttribute("uncertainty") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUncertaintyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementUnit */ class ReadCarbonMonoxideConcentrationMeasurementMeasurementUnit : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementMeasurementUnit() : ReadAttribute("measurement-unit") { } ~ReadCarbonMonoxideConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement MeasurementUnit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementMeasurementUnit : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementMeasurementUnit() : SubscribeAttribute("measurement-unit") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementUnitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementMedium */ class ReadCarbonMonoxideConcentrationMeasurementMeasurementMedium : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementMeasurementMedium() : ReadAttribute("measurement-medium") { } ~ReadCarbonMonoxideConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement MeasurementMedium read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementMeasurementMedium : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementMeasurementMedium() : SubscribeAttribute("measurement-medium") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementMediumWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LevelValue */ class ReadCarbonMonoxideConcentrationMeasurementLevelValue : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementLevelValue() : ReadAttribute("level-value") { } ~ReadCarbonMonoxideConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement LevelValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementLevelValue : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementLevelValue() : SubscribeAttribute("level-value") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLevelValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadCarbonMonoxideConcentrationMeasurementGeneratedCommandList : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadCarbonMonoxideConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadCarbonMonoxideConcentrationMeasurementAcceptedCommandList : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadCarbonMonoxideConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadCarbonMonoxideConcentrationMeasurementEventList : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementEventList() : ReadAttribute("event-list") { } ~ReadCarbonMonoxideConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadCarbonMonoxideConcentrationMeasurementAttributeList : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadCarbonMonoxideConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadCarbonMonoxideConcentrationMeasurementFeatureMap : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadCarbonMonoxideConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadCarbonMonoxideConcentrationMeasurementClusterRevision : public ReadAttribute { public: ReadCarbonMonoxideConcentrationMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadCarbonMonoxideConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonMonoxideConcentrationMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonMonoxideConcentrationMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeCarbonMonoxideConcentrationMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeCarbonMonoxideConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonMonoxideConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonMonoxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonMonoxideConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster CarbonDioxideConcentrationMeasurement | 0x040D | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MeasuredValue | 0x0000 | | * MinMeasuredValue | 0x0001 | | * MaxMeasuredValue | 0x0002 | | * PeakMeasuredValue | 0x0003 | | * PeakMeasuredValueWindow | 0x0004 | | * AverageMeasuredValue | 0x0005 | | * AverageMeasuredValueWindow | 0x0006 | | * Uncertainty | 0x0007 | | * MeasurementUnit | 0x0008 | | * MeasurementMedium | 0x0009 | | * LevelValue | 0x000A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute MeasuredValue */ class ReadCarbonDioxideConcentrationMeasurementMeasuredValue : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementMeasuredValue() : ReadAttribute("measured-value") { } ~ReadCarbonDioxideConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement MeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementMeasuredValue() : SubscribeAttribute("measured-value") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinMeasuredValue */ class ReadCarbonDioxideConcentrationMeasurementMinMeasuredValue : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementMinMeasuredValue() : ReadAttribute("min-measured-value") { } ~ReadCarbonDioxideConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement MinMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementMinMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementMinMeasuredValue() : SubscribeAttribute("min-measured-value") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxMeasuredValue */ class ReadCarbonDioxideConcentrationMeasurementMaxMeasuredValue : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementMaxMeasuredValue() : ReadAttribute("max-measured-value") { } ~ReadCarbonDioxideConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement MaxMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementMaxMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementMaxMeasuredValue() : SubscribeAttribute("max-measured-value") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValue */ class ReadCarbonDioxideConcentrationMeasurementPeakMeasuredValue : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementPeakMeasuredValue() : ReadAttribute("peak-measured-value") { } ~ReadCarbonDioxideConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement PeakMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementPeakMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementPeakMeasuredValue() : SubscribeAttribute("peak-measured-value") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValueWindow */ class ReadCarbonDioxideConcentrationMeasurementPeakMeasuredValueWindow : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementPeakMeasuredValueWindow() : ReadAttribute("peak-measured-value-window") { } ~ReadCarbonDioxideConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement PeakMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementPeakMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementPeakMeasuredValueWindow() : SubscribeAttribute("peak-measured-value-window") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValue */ class ReadCarbonDioxideConcentrationMeasurementAverageMeasuredValue : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementAverageMeasuredValue() : ReadAttribute("average-measured-value") { } ~ReadCarbonDioxideConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement AverageMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementAverageMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementAverageMeasuredValue() : SubscribeAttribute("average-measured-value") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValueWindow */ class ReadCarbonDioxideConcentrationMeasurementAverageMeasuredValueWindow : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementAverageMeasuredValueWindow() : ReadAttribute("average-measured-value-window") { } ~ReadCarbonDioxideConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement AverageMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementAverageMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementAverageMeasuredValueWindow() : SubscribeAttribute("average-measured-value-window") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Uncertainty */ class ReadCarbonDioxideConcentrationMeasurementUncertainty : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementUncertainty() : ReadAttribute("uncertainty") { } ~ReadCarbonDioxideConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUncertaintyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement Uncertainty read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementUncertainty : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementUncertainty() : SubscribeAttribute("uncertainty") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUncertaintyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementUnit */ class ReadCarbonDioxideConcentrationMeasurementMeasurementUnit : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementMeasurementUnit() : ReadAttribute("measurement-unit") { } ~ReadCarbonDioxideConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement MeasurementUnit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementMeasurementUnit : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementMeasurementUnit() : SubscribeAttribute("measurement-unit") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementUnitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementMedium */ class ReadCarbonDioxideConcentrationMeasurementMeasurementMedium : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementMeasurementMedium() : ReadAttribute("measurement-medium") { } ~ReadCarbonDioxideConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement MeasurementMedium read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementMeasurementMedium : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementMeasurementMedium() : SubscribeAttribute("measurement-medium") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementMediumWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LevelValue */ class ReadCarbonDioxideConcentrationMeasurementLevelValue : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementLevelValue() : ReadAttribute("level-value") { } ~ReadCarbonDioxideConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement LevelValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementLevelValue : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementLevelValue() : SubscribeAttribute("level-value") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLevelValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadCarbonDioxideConcentrationMeasurementGeneratedCommandList : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadCarbonDioxideConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadCarbonDioxideConcentrationMeasurementAcceptedCommandList : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadCarbonDioxideConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadCarbonDioxideConcentrationMeasurementEventList : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementEventList() : ReadAttribute("event-list") { } ~ReadCarbonDioxideConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadCarbonDioxideConcentrationMeasurementAttributeList : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadCarbonDioxideConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadCarbonDioxideConcentrationMeasurementFeatureMap : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadCarbonDioxideConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadCarbonDioxideConcentrationMeasurementClusterRevision : public ReadAttribute { public: ReadCarbonDioxideConcentrationMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadCarbonDioxideConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CarbonDioxideConcentrationMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCarbonDioxideConcentrationMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeCarbonDioxideConcentrationMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeCarbonDioxideConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CarbonDioxideConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCarbonDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CarbonDioxideConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster NitrogenDioxideConcentrationMeasurement | 0x0413 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MeasuredValue | 0x0000 | | * MinMeasuredValue | 0x0001 | | * MaxMeasuredValue | 0x0002 | | * PeakMeasuredValue | 0x0003 | | * PeakMeasuredValueWindow | 0x0004 | | * AverageMeasuredValue | 0x0005 | | * AverageMeasuredValueWindow | 0x0006 | | * Uncertainty | 0x0007 | | * MeasurementUnit | 0x0008 | | * MeasurementMedium | 0x0009 | | * LevelValue | 0x000A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute MeasuredValue */ class ReadNitrogenDioxideConcentrationMeasurementMeasuredValue : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementMeasuredValue() : ReadAttribute("measured-value") { } ~ReadNitrogenDioxideConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement MeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementMeasuredValue() : SubscribeAttribute("measured-value") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinMeasuredValue */ class ReadNitrogenDioxideConcentrationMeasurementMinMeasuredValue : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementMinMeasuredValue() : ReadAttribute("min-measured-value") { } ~ReadNitrogenDioxideConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement MinMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementMinMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementMinMeasuredValue() : SubscribeAttribute("min-measured-value") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxMeasuredValue */ class ReadNitrogenDioxideConcentrationMeasurementMaxMeasuredValue : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementMaxMeasuredValue() : ReadAttribute("max-measured-value") { } ~ReadNitrogenDioxideConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement MaxMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementMaxMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementMaxMeasuredValue() : SubscribeAttribute("max-measured-value") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValue */ class ReadNitrogenDioxideConcentrationMeasurementPeakMeasuredValue : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementPeakMeasuredValue() : ReadAttribute("peak-measured-value") { } ~ReadNitrogenDioxideConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement PeakMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementPeakMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementPeakMeasuredValue() : SubscribeAttribute("peak-measured-value") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValueWindow */ class ReadNitrogenDioxideConcentrationMeasurementPeakMeasuredValueWindow : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementPeakMeasuredValueWindow() : ReadAttribute("peak-measured-value-window") { } ~ReadNitrogenDioxideConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement PeakMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementPeakMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementPeakMeasuredValueWindow() : SubscribeAttribute("peak-measured-value-window") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValue */ class ReadNitrogenDioxideConcentrationMeasurementAverageMeasuredValue : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementAverageMeasuredValue() : ReadAttribute("average-measured-value") { } ~ReadNitrogenDioxideConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement AverageMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementAverageMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementAverageMeasuredValue() : SubscribeAttribute("average-measured-value") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValueWindow */ class ReadNitrogenDioxideConcentrationMeasurementAverageMeasuredValueWindow : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementAverageMeasuredValueWindow() : ReadAttribute("average-measured-value-window") { } ~ReadNitrogenDioxideConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement AverageMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementAverageMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementAverageMeasuredValueWindow() : SubscribeAttribute("average-measured-value-window") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Uncertainty */ class ReadNitrogenDioxideConcentrationMeasurementUncertainty : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementUncertainty() : ReadAttribute("uncertainty") { } ~ReadNitrogenDioxideConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUncertaintyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement Uncertainty read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementUncertainty : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementUncertainty() : SubscribeAttribute("uncertainty") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUncertaintyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementUnit */ class ReadNitrogenDioxideConcentrationMeasurementMeasurementUnit : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementMeasurementUnit() : ReadAttribute("measurement-unit") { } ~ReadNitrogenDioxideConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement MeasurementUnit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementMeasurementUnit : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementMeasurementUnit() : SubscribeAttribute("measurement-unit") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementUnitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementMedium */ class ReadNitrogenDioxideConcentrationMeasurementMeasurementMedium : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementMeasurementMedium() : ReadAttribute("measurement-medium") { } ~ReadNitrogenDioxideConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement MeasurementMedium read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementMeasurementMedium : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementMeasurementMedium() : SubscribeAttribute("measurement-medium") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementMediumWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LevelValue */ class ReadNitrogenDioxideConcentrationMeasurementLevelValue : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementLevelValue() : ReadAttribute("level-value") { } ~ReadNitrogenDioxideConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement LevelValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementLevelValue : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementLevelValue() : SubscribeAttribute("level-value") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLevelValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadNitrogenDioxideConcentrationMeasurementGeneratedCommandList : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadNitrogenDioxideConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadNitrogenDioxideConcentrationMeasurementAcceptedCommandList : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadNitrogenDioxideConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadNitrogenDioxideConcentrationMeasurementEventList : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementEventList() : ReadAttribute("event-list") { } ~ReadNitrogenDioxideConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadNitrogenDioxideConcentrationMeasurementAttributeList : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadNitrogenDioxideConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadNitrogenDioxideConcentrationMeasurementFeatureMap : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadNitrogenDioxideConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadNitrogenDioxideConcentrationMeasurementClusterRevision : public ReadAttribute { public: ReadNitrogenDioxideConcentrationMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadNitrogenDioxideConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("NitrogenDioxideConcentrationMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeNitrogenDioxideConcentrationMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeNitrogenDioxideConcentrationMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeNitrogenDioxideConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::NitrogenDioxideConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterNitrogenDioxideConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NitrogenDioxideConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster OzoneConcentrationMeasurement | 0x0415 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MeasuredValue | 0x0000 | | * MinMeasuredValue | 0x0001 | | * MaxMeasuredValue | 0x0002 | | * PeakMeasuredValue | 0x0003 | | * PeakMeasuredValueWindow | 0x0004 | | * AverageMeasuredValue | 0x0005 | | * AverageMeasuredValueWindow | 0x0006 | | * Uncertainty | 0x0007 | | * MeasurementUnit | 0x0008 | | * MeasurementMedium | 0x0009 | | * LevelValue | 0x000A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute MeasuredValue */ class ReadOzoneConcentrationMeasurementMeasuredValue : public ReadAttribute { public: ReadOzoneConcentrationMeasurementMeasuredValue() : ReadAttribute("measured-value") { } ~ReadOzoneConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement MeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementMeasuredValue() : SubscribeAttribute("measured-value") { } ~SubscribeAttributeOzoneConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinMeasuredValue */ class ReadOzoneConcentrationMeasurementMinMeasuredValue : public ReadAttribute { public: ReadOzoneConcentrationMeasurementMinMeasuredValue() : ReadAttribute("min-measured-value") { } ~ReadOzoneConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement MinMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementMinMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementMinMeasuredValue() : SubscribeAttribute("min-measured-value") { } ~SubscribeAttributeOzoneConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxMeasuredValue */ class ReadOzoneConcentrationMeasurementMaxMeasuredValue : public ReadAttribute { public: ReadOzoneConcentrationMeasurementMaxMeasuredValue() : ReadAttribute("max-measured-value") { } ~ReadOzoneConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement MaxMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementMaxMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementMaxMeasuredValue() : SubscribeAttribute("max-measured-value") { } ~SubscribeAttributeOzoneConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValue */ class ReadOzoneConcentrationMeasurementPeakMeasuredValue : public ReadAttribute { public: ReadOzoneConcentrationMeasurementPeakMeasuredValue() : ReadAttribute("peak-measured-value") { } ~ReadOzoneConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement PeakMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementPeakMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementPeakMeasuredValue() : SubscribeAttribute("peak-measured-value") { } ~SubscribeAttributeOzoneConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValueWindow */ class ReadOzoneConcentrationMeasurementPeakMeasuredValueWindow : public ReadAttribute { public: ReadOzoneConcentrationMeasurementPeakMeasuredValueWindow() : ReadAttribute("peak-measured-value-window") { } ~ReadOzoneConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement PeakMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementPeakMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementPeakMeasuredValueWindow() : SubscribeAttribute("peak-measured-value-window") { } ~SubscribeAttributeOzoneConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValue */ class ReadOzoneConcentrationMeasurementAverageMeasuredValue : public ReadAttribute { public: ReadOzoneConcentrationMeasurementAverageMeasuredValue() : ReadAttribute("average-measured-value") { } ~ReadOzoneConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement AverageMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementAverageMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementAverageMeasuredValue() : SubscribeAttribute("average-measured-value") { } ~SubscribeAttributeOzoneConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValueWindow */ class ReadOzoneConcentrationMeasurementAverageMeasuredValueWindow : public ReadAttribute { public: ReadOzoneConcentrationMeasurementAverageMeasuredValueWindow() : ReadAttribute("average-measured-value-window") { } ~ReadOzoneConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement AverageMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementAverageMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementAverageMeasuredValueWindow() : SubscribeAttribute("average-measured-value-window") { } ~SubscribeAttributeOzoneConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Uncertainty */ class ReadOzoneConcentrationMeasurementUncertainty : public ReadAttribute { public: ReadOzoneConcentrationMeasurementUncertainty() : ReadAttribute("uncertainty") { } ~ReadOzoneConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUncertaintyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement Uncertainty read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementUncertainty : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementUncertainty() : SubscribeAttribute("uncertainty") { } ~SubscribeAttributeOzoneConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUncertaintyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementUnit */ class ReadOzoneConcentrationMeasurementMeasurementUnit : public ReadAttribute { public: ReadOzoneConcentrationMeasurementMeasurementUnit() : ReadAttribute("measurement-unit") { } ~ReadOzoneConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement MeasurementUnit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementMeasurementUnit : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementMeasurementUnit() : SubscribeAttribute("measurement-unit") { } ~SubscribeAttributeOzoneConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementUnitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementMedium */ class ReadOzoneConcentrationMeasurementMeasurementMedium : public ReadAttribute { public: ReadOzoneConcentrationMeasurementMeasurementMedium() : ReadAttribute("measurement-medium") { } ~ReadOzoneConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement MeasurementMedium read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementMeasurementMedium : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementMeasurementMedium() : SubscribeAttribute("measurement-medium") { } ~SubscribeAttributeOzoneConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementMediumWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LevelValue */ class ReadOzoneConcentrationMeasurementLevelValue : public ReadAttribute { public: ReadOzoneConcentrationMeasurementLevelValue() : ReadAttribute("level-value") { } ~ReadOzoneConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement LevelValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementLevelValue : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementLevelValue() : SubscribeAttribute("level-value") { } ~SubscribeAttributeOzoneConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLevelValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadOzoneConcentrationMeasurementGeneratedCommandList : public ReadAttribute { public: ReadOzoneConcentrationMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadOzoneConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeOzoneConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadOzoneConcentrationMeasurementAcceptedCommandList : public ReadAttribute { public: ReadOzoneConcentrationMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadOzoneConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeOzoneConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadOzoneConcentrationMeasurementEventList : public ReadAttribute { public: ReadOzoneConcentrationMeasurementEventList() : ReadAttribute("event-list") { } ~ReadOzoneConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeOzoneConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadOzoneConcentrationMeasurementAttributeList : public ReadAttribute { public: ReadOzoneConcentrationMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadOzoneConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeOzoneConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadOzoneConcentrationMeasurementFeatureMap : public ReadAttribute { public: ReadOzoneConcentrationMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadOzoneConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeOzoneConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadOzoneConcentrationMeasurementClusterRevision : public ReadAttribute { public: ReadOzoneConcentrationMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadOzoneConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("OzoneConcentrationMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeOzoneConcentrationMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeOzoneConcentrationMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeOzoneConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::OzoneConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::OzoneConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterOzoneConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OzoneConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster Pm25ConcentrationMeasurement | 0x042A | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MeasuredValue | 0x0000 | | * MinMeasuredValue | 0x0001 | | * MaxMeasuredValue | 0x0002 | | * PeakMeasuredValue | 0x0003 | | * PeakMeasuredValueWindow | 0x0004 | | * AverageMeasuredValue | 0x0005 | | * AverageMeasuredValueWindow | 0x0006 | | * Uncertainty | 0x0007 | | * MeasurementUnit | 0x0008 | | * MeasurementMedium | 0x0009 | | * LevelValue | 0x000A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute MeasuredValue */ class ReadPm25ConcentrationMeasurementMeasuredValue : public ReadAttribute { public: ReadPm25ConcentrationMeasurementMeasuredValue() : ReadAttribute("measured-value") { } ~ReadPm25ConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement MeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementMeasuredValue() : SubscribeAttribute("measured-value") { } ~SubscribeAttributePm25ConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinMeasuredValue */ class ReadPm25ConcentrationMeasurementMinMeasuredValue : public ReadAttribute { public: ReadPm25ConcentrationMeasurementMinMeasuredValue() : ReadAttribute("min-measured-value") { } ~ReadPm25ConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement MinMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementMinMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementMinMeasuredValue() : SubscribeAttribute("min-measured-value") { } ~SubscribeAttributePm25ConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxMeasuredValue */ class ReadPm25ConcentrationMeasurementMaxMeasuredValue : public ReadAttribute { public: ReadPm25ConcentrationMeasurementMaxMeasuredValue() : ReadAttribute("max-measured-value") { } ~ReadPm25ConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement MaxMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementMaxMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementMaxMeasuredValue() : SubscribeAttribute("max-measured-value") { } ~SubscribeAttributePm25ConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValue */ class ReadPm25ConcentrationMeasurementPeakMeasuredValue : public ReadAttribute { public: ReadPm25ConcentrationMeasurementPeakMeasuredValue() : ReadAttribute("peak-measured-value") { } ~ReadPm25ConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement PeakMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementPeakMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementPeakMeasuredValue() : SubscribeAttribute("peak-measured-value") { } ~SubscribeAttributePm25ConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValueWindow */ class ReadPm25ConcentrationMeasurementPeakMeasuredValueWindow : public ReadAttribute { public: ReadPm25ConcentrationMeasurementPeakMeasuredValueWindow() : ReadAttribute("peak-measured-value-window") { } ~ReadPm25ConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement PeakMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementPeakMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementPeakMeasuredValueWindow() : SubscribeAttribute("peak-measured-value-window") { } ~SubscribeAttributePm25ConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValue */ class ReadPm25ConcentrationMeasurementAverageMeasuredValue : public ReadAttribute { public: ReadPm25ConcentrationMeasurementAverageMeasuredValue() : ReadAttribute("average-measured-value") { } ~ReadPm25ConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement AverageMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementAverageMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementAverageMeasuredValue() : SubscribeAttribute("average-measured-value") { } ~SubscribeAttributePm25ConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValueWindow */ class ReadPm25ConcentrationMeasurementAverageMeasuredValueWindow : public ReadAttribute { public: ReadPm25ConcentrationMeasurementAverageMeasuredValueWindow() : ReadAttribute("average-measured-value-window") { } ~ReadPm25ConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement AverageMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementAverageMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementAverageMeasuredValueWindow() : SubscribeAttribute("average-measured-value-window") { } ~SubscribeAttributePm25ConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Uncertainty */ class ReadPm25ConcentrationMeasurementUncertainty : public ReadAttribute { public: ReadPm25ConcentrationMeasurementUncertainty() : ReadAttribute("uncertainty") { } ~ReadPm25ConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUncertaintyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement Uncertainty read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementUncertainty : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementUncertainty() : SubscribeAttribute("uncertainty") { } ~SubscribeAttributePm25ConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUncertaintyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementUnit */ class ReadPm25ConcentrationMeasurementMeasurementUnit : public ReadAttribute { public: ReadPm25ConcentrationMeasurementMeasurementUnit() : ReadAttribute("measurement-unit") { } ~ReadPm25ConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement MeasurementUnit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementMeasurementUnit : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementMeasurementUnit() : SubscribeAttribute("measurement-unit") { } ~SubscribeAttributePm25ConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementUnitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementMedium */ class ReadPm25ConcentrationMeasurementMeasurementMedium : public ReadAttribute { public: ReadPm25ConcentrationMeasurementMeasurementMedium() : ReadAttribute("measurement-medium") { } ~ReadPm25ConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement MeasurementMedium read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementMeasurementMedium : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementMeasurementMedium() : SubscribeAttribute("measurement-medium") { } ~SubscribeAttributePm25ConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementMediumWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LevelValue */ class ReadPm25ConcentrationMeasurementLevelValue : public ReadAttribute { public: ReadPm25ConcentrationMeasurementLevelValue() : ReadAttribute("level-value") { } ~ReadPm25ConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement LevelValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementLevelValue : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementLevelValue() : SubscribeAttribute("level-value") { } ~SubscribeAttributePm25ConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLevelValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadPm25ConcentrationMeasurementGeneratedCommandList : public ReadAttribute { public: ReadPm25ConcentrationMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadPm25ConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributePm25ConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadPm25ConcentrationMeasurementAcceptedCommandList : public ReadAttribute { public: ReadPm25ConcentrationMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadPm25ConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributePm25ConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadPm25ConcentrationMeasurementEventList : public ReadAttribute { public: ReadPm25ConcentrationMeasurementEventList() : ReadAttribute("event-list") { } ~ReadPm25ConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributePm25ConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadPm25ConcentrationMeasurementAttributeList : public ReadAttribute { public: ReadPm25ConcentrationMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadPm25ConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributePm25ConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadPm25ConcentrationMeasurementFeatureMap : public ReadAttribute { public: ReadPm25ConcentrationMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadPm25ConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributePm25ConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadPm25ConcentrationMeasurementClusterRevision : public ReadAttribute { public: ReadPm25ConcentrationMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadPm25ConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM25ConcentrationMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm25ConcentrationMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributePm25ConcentrationMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributePm25ConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm25ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm25ConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM25ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM25ConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster FormaldehydeConcentrationMeasurement | 0x042B | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MeasuredValue | 0x0000 | | * MinMeasuredValue | 0x0001 | | * MaxMeasuredValue | 0x0002 | | * PeakMeasuredValue | 0x0003 | | * PeakMeasuredValueWindow | 0x0004 | | * AverageMeasuredValue | 0x0005 | | * AverageMeasuredValueWindow | 0x0006 | | * Uncertainty | 0x0007 | | * MeasurementUnit | 0x0008 | | * MeasurementMedium | 0x0009 | | * LevelValue | 0x000A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute MeasuredValue */ class ReadFormaldehydeConcentrationMeasurementMeasuredValue : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementMeasuredValue() : ReadAttribute("measured-value") { } ~ReadFormaldehydeConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement MeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementMeasuredValue() : SubscribeAttribute("measured-value") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinMeasuredValue */ class ReadFormaldehydeConcentrationMeasurementMinMeasuredValue : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementMinMeasuredValue() : ReadAttribute("min-measured-value") { } ~ReadFormaldehydeConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement MinMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementMinMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementMinMeasuredValue() : SubscribeAttribute("min-measured-value") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxMeasuredValue */ class ReadFormaldehydeConcentrationMeasurementMaxMeasuredValue : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementMaxMeasuredValue() : ReadAttribute("max-measured-value") { } ~ReadFormaldehydeConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement MaxMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementMaxMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementMaxMeasuredValue() : SubscribeAttribute("max-measured-value") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValue */ class ReadFormaldehydeConcentrationMeasurementPeakMeasuredValue : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementPeakMeasuredValue() : ReadAttribute("peak-measured-value") { } ~ReadFormaldehydeConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement PeakMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementPeakMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementPeakMeasuredValue() : SubscribeAttribute("peak-measured-value") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValueWindow */ class ReadFormaldehydeConcentrationMeasurementPeakMeasuredValueWindow : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementPeakMeasuredValueWindow() : ReadAttribute("peak-measured-value-window") { } ~ReadFormaldehydeConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement PeakMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementPeakMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementPeakMeasuredValueWindow() : SubscribeAttribute("peak-measured-value-window") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValue */ class ReadFormaldehydeConcentrationMeasurementAverageMeasuredValue : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementAverageMeasuredValue() : ReadAttribute("average-measured-value") { } ~ReadFormaldehydeConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement AverageMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementAverageMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementAverageMeasuredValue() : SubscribeAttribute("average-measured-value") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValueWindow */ class ReadFormaldehydeConcentrationMeasurementAverageMeasuredValueWindow : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementAverageMeasuredValueWindow() : ReadAttribute("average-measured-value-window") { } ~ReadFormaldehydeConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement AverageMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementAverageMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementAverageMeasuredValueWindow() : SubscribeAttribute("average-measured-value-window") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Uncertainty */ class ReadFormaldehydeConcentrationMeasurementUncertainty : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementUncertainty() : ReadAttribute("uncertainty") { } ~ReadFormaldehydeConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUncertaintyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement Uncertainty read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementUncertainty : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementUncertainty() : SubscribeAttribute("uncertainty") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUncertaintyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementUnit */ class ReadFormaldehydeConcentrationMeasurementMeasurementUnit : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementMeasurementUnit() : ReadAttribute("measurement-unit") { } ~ReadFormaldehydeConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement MeasurementUnit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementMeasurementUnit : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementMeasurementUnit() : SubscribeAttribute("measurement-unit") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementUnitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementMedium */ class ReadFormaldehydeConcentrationMeasurementMeasurementMedium : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementMeasurementMedium() : ReadAttribute("measurement-medium") { } ~ReadFormaldehydeConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement MeasurementMedium read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementMeasurementMedium : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementMeasurementMedium() : SubscribeAttribute("measurement-medium") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementMediumWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LevelValue */ class ReadFormaldehydeConcentrationMeasurementLevelValue : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementLevelValue() : ReadAttribute("level-value") { } ~ReadFormaldehydeConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement LevelValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementLevelValue : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementLevelValue() : SubscribeAttribute("level-value") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLevelValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadFormaldehydeConcentrationMeasurementGeneratedCommandList : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadFormaldehydeConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadFormaldehydeConcentrationMeasurementAcceptedCommandList : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadFormaldehydeConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadFormaldehydeConcentrationMeasurementEventList : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementEventList() : ReadAttribute("event-list") { } ~ReadFormaldehydeConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadFormaldehydeConcentrationMeasurementAttributeList : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadFormaldehydeConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadFormaldehydeConcentrationMeasurementFeatureMap : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadFormaldehydeConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadFormaldehydeConcentrationMeasurementClusterRevision : public ReadAttribute { public: ReadFormaldehydeConcentrationMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadFormaldehydeConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("FormaldehydeConcentrationMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeFormaldehydeConcentrationMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeFormaldehydeConcentrationMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeFormaldehydeConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::FormaldehydeConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterFormaldehydeConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FormaldehydeConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster Pm1ConcentrationMeasurement | 0x042C | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MeasuredValue | 0x0000 | | * MinMeasuredValue | 0x0001 | | * MaxMeasuredValue | 0x0002 | | * PeakMeasuredValue | 0x0003 | | * PeakMeasuredValueWindow | 0x0004 | | * AverageMeasuredValue | 0x0005 | | * AverageMeasuredValueWindow | 0x0006 | | * Uncertainty | 0x0007 | | * MeasurementUnit | 0x0008 | | * MeasurementMedium | 0x0009 | | * LevelValue | 0x000A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute MeasuredValue */ class ReadPm1ConcentrationMeasurementMeasuredValue : public ReadAttribute { public: ReadPm1ConcentrationMeasurementMeasuredValue() : ReadAttribute("measured-value") { } ~ReadPm1ConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement MeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementMeasuredValue() : SubscribeAttribute("measured-value") { } ~SubscribeAttributePm1ConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinMeasuredValue */ class ReadPm1ConcentrationMeasurementMinMeasuredValue : public ReadAttribute { public: ReadPm1ConcentrationMeasurementMinMeasuredValue() : ReadAttribute("min-measured-value") { } ~ReadPm1ConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement MinMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementMinMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementMinMeasuredValue() : SubscribeAttribute("min-measured-value") { } ~SubscribeAttributePm1ConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxMeasuredValue */ class ReadPm1ConcentrationMeasurementMaxMeasuredValue : public ReadAttribute { public: ReadPm1ConcentrationMeasurementMaxMeasuredValue() : ReadAttribute("max-measured-value") { } ~ReadPm1ConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement MaxMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementMaxMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementMaxMeasuredValue() : SubscribeAttribute("max-measured-value") { } ~SubscribeAttributePm1ConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValue */ class ReadPm1ConcentrationMeasurementPeakMeasuredValue : public ReadAttribute { public: ReadPm1ConcentrationMeasurementPeakMeasuredValue() : ReadAttribute("peak-measured-value") { } ~ReadPm1ConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement PeakMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementPeakMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementPeakMeasuredValue() : SubscribeAttribute("peak-measured-value") { } ~SubscribeAttributePm1ConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValueWindow */ class ReadPm1ConcentrationMeasurementPeakMeasuredValueWindow : public ReadAttribute { public: ReadPm1ConcentrationMeasurementPeakMeasuredValueWindow() : ReadAttribute("peak-measured-value-window") { } ~ReadPm1ConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement PeakMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementPeakMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementPeakMeasuredValueWindow() : SubscribeAttribute("peak-measured-value-window") { } ~SubscribeAttributePm1ConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValue */ class ReadPm1ConcentrationMeasurementAverageMeasuredValue : public ReadAttribute { public: ReadPm1ConcentrationMeasurementAverageMeasuredValue() : ReadAttribute("average-measured-value") { } ~ReadPm1ConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement AverageMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementAverageMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementAverageMeasuredValue() : SubscribeAttribute("average-measured-value") { } ~SubscribeAttributePm1ConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValueWindow */ class ReadPm1ConcentrationMeasurementAverageMeasuredValueWindow : public ReadAttribute { public: ReadPm1ConcentrationMeasurementAverageMeasuredValueWindow() : ReadAttribute("average-measured-value-window") { } ~ReadPm1ConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement AverageMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementAverageMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementAverageMeasuredValueWindow() : SubscribeAttribute("average-measured-value-window") { } ~SubscribeAttributePm1ConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Uncertainty */ class ReadPm1ConcentrationMeasurementUncertainty : public ReadAttribute { public: ReadPm1ConcentrationMeasurementUncertainty() : ReadAttribute("uncertainty") { } ~ReadPm1ConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUncertaintyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement Uncertainty read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementUncertainty : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementUncertainty() : SubscribeAttribute("uncertainty") { } ~SubscribeAttributePm1ConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUncertaintyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementUnit */ class ReadPm1ConcentrationMeasurementMeasurementUnit : public ReadAttribute { public: ReadPm1ConcentrationMeasurementMeasurementUnit() : ReadAttribute("measurement-unit") { } ~ReadPm1ConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement MeasurementUnit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementMeasurementUnit : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementMeasurementUnit() : SubscribeAttribute("measurement-unit") { } ~SubscribeAttributePm1ConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementUnitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementMedium */ class ReadPm1ConcentrationMeasurementMeasurementMedium : public ReadAttribute { public: ReadPm1ConcentrationMeasurementMeasurementMedium() : ReadAttribute("measurement-medium") { } ~ReadPm1ConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement MeasurementMedium read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementMeasurementMedium : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementMeasurementMedium() : SubscribeAttribute("measurement-medium") { } ~SubscribeAttributePm1ConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementMediumWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LevelValue */ class ReadPm1ConcentrationMeasurementLevelValue : public ReadAttribute { public: ReadPm1ConcentrationMeasurementLevelValue() : ReadAttribute("level-value") { } ~ReadPm1ConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement LevelValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementLevelValue : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementLevelValue() : SubscribeAttribute("level-value") { } ~SubscribeAttributePm1ConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLevelValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadPm1ConcentrationMeasurementGeneratedCommandList : public ReadAttribute { public: ReadPm1ConcentrationMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadPm1ConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributePm1ConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadPm1ConcentrationMeasurementAcceptedCommandList : public ReadAttribute { public: ReadPm1ConcentrationMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadPm1ConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributePm1ConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadPm1ConcentrationMeasurementEventList : public ReadAttribute { public: ReadPm1ConcentrationMeasurementEventList() : ReadAttribute("event-list") { } ~ReadPm1ConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributePm1ConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadPm1ConcentrationMeasurementAttributeList : public ReadAttribute { public: ReadPm1ConcentrationMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadPm1ConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributePm1ConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadPm1ConcentrationMeasurementFeatureMap : public ReadAttribute { public: ReadPm1ConcentrationMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadPm1ConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributePm1ConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadPm1ConcentrationMeasurementClusterRevision : public ReadAttribute { public: ReadPm1ConcentrationMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadPm1ConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM1ConcentrationMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm1ConcentrationMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributePm1ConcentrationMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributePm1ConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm1ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm1ConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM1ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM1ConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster Pm10ConcentrationMeasurement | 0x042D | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MeasuredValue | 0x0000 | | * MinMeasuredValue | 0x0001 | | * MaxMeasuredValue | 0x0002 | | * PeakMeasuredValue | 0x0003 | | * PeakMeasuredValueWindow | 0x0004 | | * AverageMeasuredValue | 0x0005 | | * AverageMeasuredValueWindow | 0x0006 | | * Uncertainty | 0x0007 | | * MeasurementUnit | 0x0008 | | * MeasurementMedium | 0x0009 | | * LevelValue | 0x000A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute MeasuredValue */ class ReadPm10ConcentrationMeasurementMeasuredValue : public ReadAttribute { public: ReadPm10ConcentrationMeasurementMeasuredValue() : ReadAttribute("measured-value") { } ~ReadPm10ConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement MeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementMeasuredValue() : SubscribeAttribute("measured-value") { } ~SubscribeAttributePm10ConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinMeasuredValue */ class ReadPm10ConcentrationMeasurementMinMeasuredValue : public ReadAttribute { public: ReadPm10ConcentrationMeasurementMinMeasuredValue() : ReadAttribute("min-measured-value") { } ~ReadPm10ConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement MinMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementMinMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementMinMeasuredValue() : SubscribeAttribute("min-measured-value") { } ~SubscribeAttributePm10ConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxMeasuredValue */ class ReadPm10ConcentrationMeasurementMaxMeasuredValue : public ReadAttribute { public: ReadPm10ConcentrationMeasurementMaxMeasuredValue() : ReadAttribute("max-measured-value") { } ~ReadPm10ConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement MaxMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementMaxMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementMaxMeasuredValue() : SubscribeAttribute("max-measured-value") { } ~SubscribeAttributePm10ConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValue */ class ReadPm10ConcentrationMeasurementPeakMeasuredValue : public ReadAttribute { public: ReadPm10ConcentrationMeasurementPeakMeasuredValue() : ReadAttribute("peak-measured-value") { } ~ReadPm10ConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement PeakMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementPeakMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementPeakMeasuredValue() : SubscribeAttribute("peak-measured-value") { } ~SubscribeAttributePm10ConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValueWindow */ class ReadPm10ConcentrationMeasurementPeakMeasuredValueWindow : public ReadAttribute { public: ReadPm10ConcentrationMeasurementPeakMeasuredValueWindow() : ReadAttribute("peak-measured-value-window") { } ~ReadPm10ConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement PeakMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementPeakMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementPeakMeasuredValueWindow() : SubscribeAttribute("peak-measured-value-window") { } ~SubscribeAttributePm10ConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValue */ class ReadPm10ConcentrationMeasurementAverageMeasuredValue : public ReadAttribute { public: ReadPm10ConcentrationMeasurementAverageMeasuredValue() : ReadAttribute("average-measured-value") { } ~ReadPm10ConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement AverageMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementAverageMeasuredValue : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementAverageMeasuredValue() : SubscribeAttribute("average-measured-value") { } ~SubscribeAttributePm10ConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValueWindow */ class ReadPm10ConcentrationMeasurementAverageMeasuredValueWindow : public ReadAttribute { public: ReadPm10ConcentrationMeasurementAverageMeasuredValueWindow() : ReadAttribute("average-measured-value-window") { } ~ReadPm10ConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement AverageMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementAverageMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementAverageMeasuredValueWindow() : SubscribeAttribute("average-measured-value-window") { } ~SubscribeAttributePm10ConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Uncertainty */ class ReadPm10ConcentrationMeasurementUncertainty : public ReadAttribute { public: ReadPm10ConcentrationMeasurementUncertainty() : ReadAttribute("uncertainty") { } ~ReadPm10ConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUncertaintyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement Uncertainty read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementUncertainty : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementUncertainty() : SubscribeAttribute("uncertainty") { } ~SubscribeAttributePm10ConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUncertaintyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementUnit */ class ReadPm10ConcentrationMeasurementMeasurementUnit : public ReadAttribute { public: ReadPm10ConcentrationMeasurementMeasurementUnit() : ReadAttribute("measurement-unit") { } ~ReadPm10ConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement MeasurementUnit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementMeasurementUnit : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementMeasurementUnit() : SubscribeAttribute("measurement-unit") { } ~SubscribeAttributePm10ConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementUnitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementMedium */ class ReadPm10ConcentrationMeasurementMeasurementMedium : public ReadAttribute { public: ReadPm10ConcentrationMeasurementMeasurementMedium() : ReadAttribute("measurement-medium") { } ~ReadPm10ConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement MeasurementMedium read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementMeasurementMedium : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementMeasurementMedium() : SubscribeAttribute("measurement-medium") { } ~SubscribeAttributePm10ConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementMediumWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LevelValue */ class ReadPm10ConcentrationMeasurementLevelValue : public ReadAttribute { public: ReadPm10ConcentrationMeasurementLevelValue() : ReadAttribute("level-value") { } ~ReadPm10ConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement LevelValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementLevelValue : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementLevelValue() : SubscribeAttribute("level-value") { } ~SubscribeAttributePm10ConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLevelValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadPm10ConcentrationMeasurementGeneratedCommandList : public ReadAttribute { public: ReadPm10ConcentrationMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadPm10ConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributePm10ConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadPm10ConcentrationMeasurementAcceptedCommandList : public ReadAttribute { public: ReadPm10ConcentrationMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadPm10ConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributePm10ConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadPm10ConcentrationMeasurementEventList : public ReadAttribute { public: ReadPm10ConcentrationMeasurementEventList() : ReadAttribute("event-list") { } ~ReadPm10ConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributePm10ConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadPm10ConcentrationMeasurementAttributeList : public ReadAttribute { public: ReadPm10ConcentrationMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadPm10ConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributePm10ConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadPm10ConcentrationMeasurementFeatureMap : public ReadAttribute { public: ReadPm10ConcentrationMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadPm10ConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributePm10ConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadPm10ConcentrationMeasurementClusterRevision : public ReadAttribute { public: ReadPm10ConcentrationMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadPm10ConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("PM10ConcentrationMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributePm10ConcentrationMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributePm10ConcentrationMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributePm10ConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Pm10ConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Pm10ConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterPM10ConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PM10ConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster TotalVolatileOrganicCompoundsConcentrationMeasurement | 0x042E | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MeasuredValue | 0x0000 | | * MinMeasuredValue | 0x0001 | | * MaxMeasuredValue | 0x0002 | | * PeakMeasuredValue | 0x0003 | | * PeakMeasuredValueWindow | 0x0004 | | * AverageMeasuredValue | 0x0005 | | * AverageMeasuredValueWindow | 0x0006 | | * Uncertainty | 0x0007 | | * MeasurementUnit | 0x0008 | | * MeasurementMedium | 0x0009 | | * LevelValue | 0x000A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute MeasuredValue */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValue : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValue() : ReadAttribute("measured-value") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement MeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValue() : SubscribeAttribute("measured-value") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinMeasuredValue */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValue : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValue() : ReadAttribute("min-measured-value") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement MinMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValue() : SubscribeAttribute("min-measured-value") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxMeasuredValue */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValue : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValue() : ReadAttribute("max-measured-value") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement MaxMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValue() : SubscribeAttribute("max-measured-value") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValue */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValue : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValue() : ReadAttribute("peak-measured-value") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement PeakMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValue() : SubscribeAttribute("peak-measured-value") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValueWindow */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueWindow : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueWindow() : ReadAttribute("peak-measured-value-window") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement PeakMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueWindow() : SubscribeAttribute("peak-measured-value-window") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValue */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValue : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValue() : ReadAttribute("average-measured-value") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement AverageMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValue() : SubscribeAttribute("average-measured-value") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValueWindow */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueWindow : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueWindow() : ReadAttribute("average-measured-value-window") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement AverageMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueWindow() : SubscribeAttribute("average-measured-value-window") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Uncertainty */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementUncertainty : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementUncertainty() : ReadAttribute("uncertainty") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUncertaintyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement Uncertainty read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementUncertainty : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementUncertainty() : SubscribeAttribute("uncertainty") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUncertaintyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementUnit */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementMeasurementUnit : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementMeasurementUnit() : ReadAttribute("measurement-unit") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement MeasurementUnit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementMeasurementUnit : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementMeasurementUnit() : SubscribeAttribute("measurement-unit") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementUnitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementMedium */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementMeasurementMedium : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementMeasurementMedium() : ReadAttribute("measurement-medium") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement MeasurementMedium read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementMeasurementMedium : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementMeasurementMedium() : SubscribeAttribute("measurement-medium") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementMediumWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LevelValue */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementLevelValue : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementLevelValue() : ReadAttribute("level-value") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement LevelValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementLevelValue : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementLevelValue() : SubscribeAttribute("level-value") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLevelValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandList : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandList : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementEventList : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementEventList() : ReadAttribute("event-list") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeList : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementFeatureMap : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadTotalVolatileOrganicCompoundsConcentrationMeasurementClusterRevision : public ReadAttribute { public: ReadTotalVolatileOrganicCompoundsConcentrationMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadTotalVolatileOrganicCompoundsConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TotalVolatileOrganicCompoundsConcentrationMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeTotalVolatileOrganicCompoundsConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TotalVolatileOrganicCompoundsConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster RadonConcentrationMeasurement | 0x042F | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MeasuredValue | 0x0000 | | * MinMeasuredValue | 0x0001 | | * MaxMeasuredValue | 0x0002 | | * PeakMeasuredValue | 0x0003 | | * PeakMeasuredValueWindow | 0x0004 | | * AverageMeasuredValue | 0x0005 | | * AverageMeasuredValueWindow | 0x0006 | | * Uncertainty | 0x0007 | | * MeasurementUnit | 0x0008 | | * MeasurementMedium | 0x0009 | | * LevelValue | 0x000A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute MeasuredValue */ class ReadRadonConcentrationMeasurementMeasuredValue : public ReadAttribute { public: ReadRadonConcentrationMeasurementMeasuredValue() : ReadAttribute("measured-value") { } ~ReadRadonConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement MeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementMeasuredValue() : SubscribeAttribute("measured-value") { } ~SubscribeAttributeRadonConcentrationMeasurementMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::MeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.MeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MinMeasuredValue */ class ReadRadonConcentrationMeasurementMinMeasuredValue : public ReadAttribute { public: ReadRadonConcentrationMeasurementMinMeasuredValue() : ReadAttribute("min-measured-value") { } ~ReadRadonConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement MinMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementMinMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementMinMeasuredValue() : SubscribeAttribute("min-measured-value") { } ~SubscribeAttributeRadonConcentrationMeasurementMinMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::MinMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.MinMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MaxMeasuredValue */ class ReadRadonConcentrationMeasurementMaxMeasuredValue : public ReadAttribute { public: ReadRadonConcentrationMeasurementMaxMeasuredValue() : ReadAttribute("max-measured-value") { } ~ReadRadonConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement MaxMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementMaxMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementMaxMeasuredValue() : SubscribeAttribute("max-measured-value") { } ~SubscribeAttributeRadonConcentrationMeasurementMaxMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::MaxMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.MaxMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValue */ class ReadRadonConcentrationMeasurementPeakMeasuredValue : public ReadAttribute { public: ReadRadonConcentrationMeasurementPeakMeasuredValue() : ReadAttribute("peak-measured-value") { } ~ReadRadonConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement PeakMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementPeakMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementPeakMeasuredValue() : SubscribeAttribute("peak-measured-value") { } ~SubscribeAttributeRadonConcentrationMeasurementPeakMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::PeakMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.PeakMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PeakMeasuredValueWindow */ class ReadRadonConcentrationMeasurementPeakMeasuredValueWindow : public ReadAttribute { public: ReadRadonConcentrationMeasurementPeakMeasuredValueWindow() : ReadAttribute("peak-measured-value-window") { } ~ReadRadonConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePeakMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement PeakMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementPeakMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementPeakMeasuredValueWindow() : SubscribeAttribute("peak-measured-value-window") { } ~SubscribeAttributeRadonConcentrationMeasurementPeakMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::PeakMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePeakMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.PeakMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValue */ class ReadRadonConcentrationMeasurementAverageMeasuredValue : public ReadAttribute { public: ReadRadonConcentrationMeasurementAverageMeasuredValue() : ReadAttribute("average-measured-value") { } ~ReadRadonConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement AverageMeasuredValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementAverageMeasuredValue : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementAverageMeasuredValue() : SubscribeAttribute("average-measured-value") { } ~SubscribeAttributeRadonConcentrationMeasurementAverageMeasuredValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::AverageMeasuredValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.AverageMeasuredValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AverageMeasuredValueWindow */ class ReadRadonConcentrationMeasurementAverageMeasuredValueWindow : public ReadAttribute { public: ReadRadonConcentrationMeasurementAverageMeasuredValueWindow() : ReadAttribute("average-measured-value-window") { } ~ReadRadonConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAverageMeasuredValueWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement AverageMeasuredValueWindow read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementAverageMeasuredValueWindow : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementAverageMeasuredValueWindow() : SubscribeAttribute("average-measured-value-window") { } ~SubscribeAttributeRadonConcentrationMeasurementAverageMeasuredValueWindow() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::AverageMeasuredValueWindow::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAverageMeasuredValueWindowWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.AverageMeasuredValueWindow response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Uncertainty */ class ReadRadonConcentrationMeasurementUncertainty : public ReadAttribute { public: ReadRadonConcentrationMeasurementUncertainty() : ReadAttribute("uncertainty") { } ~ReadRadonConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUncertaintyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement Uncertainty read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementUncertainty : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementUncertainty() : SubscribeAttribute("uncertainty") { } ~SubscribeAttributeRadonConcentrationMeasurementUncertainty() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::Uncertainty::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUncertaintyWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.Uncertainty response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementUnit */ class ReadRadonConcentrationMeasurementMeasurementUnit : public ReadAttribute { public: ReadRadonConcentrationMeasurementMeasurementUnit() : ReadAttribute("measurement-unit") { } ~ReadRadonConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementUnitWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement MeasurementUnit read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementMeasurementUnit : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementMeasurementUnit() : SubscribeAttribute("measurement-unit") { } ~SubscribeAttributeRadonConcentrationMeasurementMeasurementUnit() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::MeasurementUnit::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementUnitWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.MeasurementUnit response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute MeasurementMedium */ class ReadRadonConcentrationMeasurementMeasurementMedium : public ReadAttribute { public: ReadRadonConcentrationMeasurementMeasurementMedium() : ReadAttribute("measurement-medium") { } ~ReadRadonConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeasurementMediumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement MeasurementMedium read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementMeasurementMedium : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementMeasurementMedium() : SubscribeAttribute("measurement-medium") { } ~SubscribeAttributeRadonConcentrationMeasurementMeasurementMedium() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::MeasurementMedium::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeasurementMediumWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.MeasurementMedium response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LevelValue */ class ReadRadonConcentrationMeasurementLevelValue : public ReadAttribute { public: ReadRadonConcentrationMeasurementLevelValue() : ReadAttribute("level-value") { } ~ReadRadonConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLevelValueWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement LevelValue read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementLevelValue : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementLevelValue() : SubscribeAttribute("level-value") { } ~SubscribeAttributeRadonConcentrationMeasurementLevelValue() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::LevelValue::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLevelValueWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.LevelValue response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadRadonConcentrationMeasurementGeneratedCommandList : public ReadAttribute { public: ReadRadonConcentrationMeasurementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadRadonConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeRadonConcentrationMeasurementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadRadonConcentrationMeasurementAcceptedCommandList : public ReadAttribute { public: ReadRadonConcentrationMeasurementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadRadonConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeRadonConcentrationMeasurementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadRadonConcentrationMeasurementEventList : public ReadAttribute { public: ReadRadonConcentrationMeasurementEventList() : ReadAttribute("event-list") { } ~ReadRadonConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementEventList : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeRadonConcentrationMeasurementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadRadonConcentrationMeasurementAttributeList : public ReadAttribute { public: ReadRadonConcentrationMeasurementAttributeList() : ReadAttribute("attribute-list") { } ~ReadRadonConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementAttributeList : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeRadonConcentrationMeasurementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadRadonConcentrationMeasurementFeatureMap : public ReadAttribute { public: ReadRadonConcentrationMeasurementFeatureMap() : ReadAttribute("feature-map") { } ~ReadRadonConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeRadonConcentrationMeasurementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadRadonConcentrationMeasurementClusterRevision : public ReadAttribute { public: ReadRadonConcentrationMeasurementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadRadonConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("RadonConcentrationMeasurement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeRadonConcentrationMeasurementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeRadonConcentrationMeasurementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeRadonConcentrationMeasurementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::RadonConcentrationMeasurement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::RadonConcentrationMeasurement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterRadonConcentrationMeasurement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RadonConcentrationMeasurement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster WiFiNetworkManagement | 0x0451 | |------------------------------------------------------------------------------| | Commands: | | | * NetworkPassphraseRequest | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * Ssid | 0x0000 | | * PassphraseSurrogate | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command NetworkPassphraseRequest */ class WiFiNetworkManagementNetworkPassphraseRequest : public ClusterCommand { public: WiFiNetworkManagementNetworkPassphraseRequest() : ClusterCommand("network-passphrase-request") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WiFiNetworkManagement::Commands::NetworkPassphraseRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWiFiNetworkManagementClusterNetworkPassphraseRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster networkPassphraseRequestWithParams:params completion: ^(MTRWiFiNetworkManagementClusterNetworkPassphraseResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::WiFiNetworkManagement::Commands::NetworkPassphraseResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::WiFiNetworkManagement::Commands::NetworkPassphraseResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Ssid */ class ReadWiFiNetworkManagementSsid : public ReadAttribute { public: ReadWiFiNetworkManagementSsid() : ReadAttribute("ssid") { } ~ReadWiFiNetworkManagementSsid() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::Ssid::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSSIDWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkManagement.SSID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkManagement SSID read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkManagementSsid : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkManagementSsid() : SubscribeAttribute("ssid") { } ~SubscribeAttributeWiFiNetworkManagementSsid() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::Ssid::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSSIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkManagement.SSID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute PassphraseSurrogate */ class ReadWiFiNetworkManagementPassphraseSurrogate : public ReadAttribute { public: ReadWiFiNetworkManagementPassphraseSurrogate() : ReadAttribute("passphrase-surrogate") { } ~ReadWiFiNetworkManagementPassphraseSurrogate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::PassphraseSurrogate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePassphraseSurrogateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkManagement.PassphraseSurrogate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkManagement PassphraseSurrogate read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkManagementPassphraseSurrogate : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkManagementPassphraseSurrogate() : SubscribeAttribute("passphrase-surrogate") { } ~SubscribeAttributeWiFiNetworkManagementPassphraseSurrogate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::PassphraseSurrogate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePassphraseSurrogateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkManagement.PassphraseSurrogate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadWiFiNetworkManagementGeneratedCommandList : public ReadAttribute { public: ReadWiFiNetworkManagementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadWiFiNetworkManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkManagement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkManagementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkManagementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeWiFiNetworkManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadWiFiNetworkManagementAcceptedCommandList : public ReadAttribute { public: ReadWiFiNetworkManagementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadWiFiNetworkManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkManagement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkManagementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkManagementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeWiFiNetworkManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadWiFiNetworkManagementEventList : public ReadAttribute { public: ReadWiFiNetworkManagementEventList() : ReadAttribute("event-list") { } ~ReadWiFiNetworkManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkManagement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkManagementEventList : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkManagementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeWiFiNetworkManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadWiFiNetworkManagementAttributeList : public ReadAttribute { public: ReadWiFiNetworkManagementAttributeList() : ReadAttribute("attribute-list") { } ~ReadWiFiNetworkManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkManagement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkManagementAttributeList : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkManagementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeWiFiNetworkManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadWiFiNetworkManagementFeatureMap : public ReadAttribute { public: ReadWiFiNetworkManagementFeatureMap() : ReadAttribute("feature-map") { } ~ReadWiFiNetworkManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkManagement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkManagementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkManagementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeWiFiNetworkManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadWiFiNetworkManagementClusterRevision : public ReadAttribute { public: ReadWiFiNetworkManagementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadWiFiNetworkManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WiFiNetworkManagement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWiFiNetworkManagementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeWiFiNetworkManagementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeWiFiNetworkManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WiFiNetworkManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WiFiNetworkManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWiFiNetworkManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster ThreadBorderRouterManagement | 0x0452 | |------------------------------------------------------------------------------| | Commands: | | | * GetActiveDatasetRequest | 0x00 | | * GetPendingDatasetRequest | 0x01 | | * SetActiveDatasetRequest | 0x03 | | * SetPendingDatasetRequest | 0x04 | |------------------------------------------------------------------------------| | Attributes: | | | * BorderRouterName | 0x0000 | | * BorderAgentID | 0x0001 | | * ThreadVersion | 0x0002 | | * InterfaceEnabled | 0x0003 | | * ActiveDatasetTimestamp | 0x0004 | | * PendingDatasetTimestamp | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command GetActiveDatasetRequest */ class ThreadBorderRouterManagementGetActiveDatasetRequest : public ClusterCommand { public: ThreadBorderRouterManagementGetActiveDatasetRequest() : ClusterCommand("get-active-dataset-request") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ThreadBorderRouterManagement::Commands::GetActiveDatasetRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRThreadBorderRouterManagementClusterGetActiveDatasetRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster getActiveDatasetRequestWithParams:params completion: ^(MTRThreadBorderRouterManagementClusterDatasetResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ThreadBorderRouterManagement::Commands::DatasetResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ThreadBorderRouterManagement::Commands::DatasetResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command GetPendingDatasetRequest */ class ThreadBorderRouterManagementGetPendingDatasetRequest : public ClusterCommand { public: ThreadBorderRouterManagementGetPendingDatasetRequest() : ClusterCommand("get-pending-dataset-request") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ThreadBorderRouterManagement::Commands::GetPendingDatasetRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRThreadBorderRouterManagementClusterGetPendingDatasetRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster getPendingDatasetRequestWithParams:params completion: ^(MTRThreadBorderRouterManagementClusterDatasetResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ThreadBorderRouterManagement::Commands::DatasetResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ThreadBorderRouterManagement::Commands::DatasetResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetActiveDatasetRequest */ class ThreadBorderRouterManagementSetActiveDatasetRequest : public ClusterCommand { public: ThreadBorderRouterManagementSetActiveDatasetRequest() : ClusterCommand("set-active-dataset-request") { #if MTR_ENABLE_PROVISIONAL AddArgument("ActiveDataset", &mRequest.activeDataset); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Breadcrumb", 0, UINT64_MAX, &mRequest.breadcrumb); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ThreadBorderRouterManagement::Commands::SetActiveDatasetRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRThreadBorderRouterManagementClusterSetActiveDatasetRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.activeDataset = [NSData dataWithBytes:mRequest.activeDataset.data() length:mRequest.activeDataset.size()]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.breadcrumb.HasValue()) { params.breadcrumb = [NSNumber numberWithUnsignedLongLong:mRequest.breadcrumb.Value()]; } else { params.breadcrumb = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setActiveDatasetRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ThreadBorderRouterManagement::Commands::SetActiveDatasetRequest::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetPendingDatasetRequest */ class ThreadBorderRouterManagementSetPendingDatasetRequest : public ClusterCommand { public: ThreadBorderRouterManagementSetPendingDatasetRequest() : ClusterCommand("set-pending-dataset-request") { #if MTR_ENABLE_PROVISIONAL AddArgument("PendingDataset", &mRequest.pendingDataset); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ThreadBorderRouterManagement::Commands::SetPendingDatasetRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRThreadBorderRouterManagementClusterSetPendingDatasetRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.pendingDataset = [NSData dataWithBytes:mRequest.pendingDataset.data() length:mRequest.pendingDataset.size()]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setPendingDatasetRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ThreadBorderRouterManagement::Commands::SetPendingDatasetRequest::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute BorderRouterName */ class ReadThreadBorderRouterManagementBorderRouterName : public ReadAttribute { public: ReadThreadBorderRouterManagementBorderRouterName() : ReadAttribute("border-router-name") { } ~ReadThreadBorderRouterManagementBorderRouterName() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::BorderRouterName::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBorderRouterNameWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.BorderRouterName response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadBorderRouterManagement BorderRouterName read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadBorderRouterManagementBorderRouterName : public SubscribeAttribute { public: SubscribeAttributeThreadBorderRouterManagementBorderRouterName() : SubscribeAttribute("border-router-name") { } ~SubscribeAttributeThreadBorderRouterManagementBorderRouterName() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::BorderRouterName::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBorderRouterNameWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.BorderRouterName response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute BorderAgentID */ class ReadThreadBorderRouterManagementBorderAgentID : public ReadAttribute { public: ReadThreadBorderRouterManagementBorderAgentID() : ReadAttribute("border-agent-id") { } ~ReadThreadBorderRouterManagementBorderAgentID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::BorderAgentID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBorderAgentIDWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.BorderAgentID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadBorderRouterManagement BorderAgentID read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadBorderRouterManagementBorderAgentID : public SubscribeAttribute { public: SubscribeAttributeThreadBorderRouterManagementBorderAgentID() : SubscribeAttribute("border-agent-id") { } ~SubscribeAttributeThreadBorderRouterManagementBorderAgentID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::BorderAgentID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBorderAgentIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.BorderAgentID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ThreadVersion */ class ReadThreadBorderRouterManagementThreadVersion : public ReadAttribute { public: ReadThreadBorderRouterManagementThreadVersion() : ReadAttribute("thread-version") { } ~ReadThreadBorderRouterManagementThreadVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::ThreadVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeThreadVersionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.ThreadVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadBorderRouterManagement ThreadVersion read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadBorderRouterManagementThreadVersion : public SubscribeAttribute { public: SubscribeAttributeThreadBorderRouterManagementThreadVersion() : SubscribeAttribute("thread-version") { } ~SubscribeAttributeThreadBorderRouterManagementThreadVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::ThreadVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeThreadVersionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.ThreadVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute InterfaceEnabled */ class ReadThreadBorderRouterManagementInterfaceEnabled : public ReadAttribute { public: ReadThreadBorderRouterManagementInterfaceEnabled() : ReadAttribute("interface-enabled") { } ~ReadThreadBorderRouterManagementInterfaceEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::InterfaceEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInterfaceEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.InterfaceEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadBorderRouterManagement InterfaceEnabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadBorderRouterManagementInterfaceEnabled : public SubscribeAttribute { public: SubscribeAttributeThreadBorderRouterManagementInterfaceEnabled() : SubscribeAttribute("interface-enabled") { } ~SubscribeAttributeThreadBorderRouterManagementInterfaceEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::InterfaceEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInterfaceEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.InterfaceEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ActiveDatasetTimestamp */ class ReadThreadBorderRouterManagementActiveDatasetTimestamp : public ReadAttribute { public: ReadThreadBorderRouterManagementActiveDatasetTimestamp() : ReadAttribute("active-dataset-timestamp") { } ~ReadThreadBorderRouterManagementActiveDatasetTimestamp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::ActiveDatasetTimestamp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveDatasetTimestampWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.ActiveDatasetTimestamp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadBorderRouterManagement ActiveDatasetTimestamp read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadBorderRouterManagementActiveDatasetTimestamp : public SubscribeAttribute { public: SubscribeAttributeThreadBorderRouterManagementActiveDatasetTimestamp() : SubscribeAttribute("active-dataset-timestamp") { } ~SubscribeAttributeThreadBorderRouterManagementActiveDatasetTimestamp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::ActiveDatasetTimestamp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveDatasetTimestampWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.ActiveDatasetTimestamp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute PendingDatasetTimestamp */ class ReadThreadBorderRouterManagementPendingDatasetTimestamp : public ReadAttribute { public: ReadThreadBorderRouterManagementPendingDatasetTimestamp() : ReadAttribute("pending-dataset-timestamp") { } ~ReadThreadBorderRouterManagementPendingDatasetTimestamp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::PendingDatasetTimestamp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePendingDatasetTimestampWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.PendingDatasetTimestamp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadBorderRouterManagement PendingDatasetTimestamp read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadBorderRouterManagementPendingDatasetTimestamp : public SubscribeAttribute { public: SubscribeAttributeThreadBorderRouterManagementPendingDatasetTimestamp() : SubscribeAttribute("pending-dataset-timestamp") { } ~SubscribeAttributeThreadBorderRouterManagementPendingDatasetTimestamp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::PendingDatasetTimestamp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePendingDatasetTimestampWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.PendingDatasetTimestamp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadThreadBorderRouterManagementGeneratedCommandList : public ReadAttribute { public: ReadThreadBorderRouterManagementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadThreadBorderRouterManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadBorderRouterManagement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadBorderRouterManagementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeThreadBorderRouterManagementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeThreadBorderRouterManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadThreadBorderRouterManagementAcceptedCommandList : public ReadAttribute { public: ReadThreadBorderRouterManagementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadThreadBorderRouterManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadBorderRouterManagement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadBorderRouterManagementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeThreadBorderRouterManagementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeThreadBorderRouterManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadThreadBorderRouterManagementEventList : public ReadAttribute { public: ReadThreadBorderRouterManagementEventList() : ReadAttribute("event-list") { } ~ReadThreadBorderRouterManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadBorderRouterManagement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadBorderRouterManagementEventList : public SubscribeAttribute { public: SubscribeAttributeThreadBorderRouterManagementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeThreadBorderRouterManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadThreadBorderRouterManagementAttributeList : public ReadAttribute { public: ReadThreadBorderRouterManagementAttributeList() : ReadAttribute("attribute-list") { } ~ReadThreadBorderRouterManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadBorderRouterManagement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadBorderRouterManagementAttributeList : public SubscribeAttribute { public: SubscribeAttributeThreadBorderRouterManagementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeThreadBorderRouterManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadThreadBorderRouterManagementFeatureMap : public ReadAttribute { public: ReadThreadBorderRouterManagementFeatureMap() : ReadAttribute("feature-map") { } ~ReadThreadBorderRouterManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadBorderRouterManagement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadBorderRouterManagementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeThreadBorderRouterManagementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeThreadBorderRouterManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadThreadBorderRouterManagementClusterRevision : public ReadAttribute { public: ReadThreadBorderRouterManagementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadThreadBorderRouterManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadBorderRouterManagement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadBorderRouterManagementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeThreadBorderRouterManagementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeThreadBorderRouterManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadBorderRouterManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadBorderRouterManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadBorderRouterManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadBorderRouterManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster ThreadNetworkDirectory | 0x0453 | |------------------------------------------------------------------------------| | Commands: | | | * AddNetwork | 0x00 | | * RemoveNetwork | 0x01 | | * GetOperationalDataset | 0x02 | |------------------------------------------------------------------------------| | Attributes: | | | * PreferredExtendedPanID | 0x0000 | | * ThreadNetworks | 0x0001 | | * ThreadNetworkTableSize | 0x0002 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command AddNetwork */ class ThreadNetworkDirectoryAddNetwork : public ClusterCommand { public: ThreadNetworkDirectoryAddNetwork() : ClusterCommand("add-network") { #if MTR_ENABLE_PROVISIONAL AddArgument("OperationalDataset", &mRequest.operationalDataset); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ThreadNetworkDirectory::Commands::AddNetwork::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRThreadNetworkDirectoryClusterAddNetworkParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.operationalDataset = [NSData dataWithBytes:mRequest.operationalDataset.data() length:mRequest.operationalDataset.size()]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster addNetworkWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ThreadNetworkDirectory::Commands::AddNetwork::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command RemoveNetwork */ class ThreadNetworkDirectoryRemoveNetwork : public ClusterCommand { public: ThreadNetworkDirectoryRemoveNetwork() : ClusterCommand("remove-network") { #if MTR_ENABLE_PROVISIONAL AddArgument("ExtendedPanID", &mRequest.extendedPanID); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ThreadNetworkDirectory::Commands::RemoveNetwork::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRThreadNetworkDirectoryClusterRemoveNetworkParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.extendedPanID = [NSData dataWithBytes:mRequest.extendedPanID.data() length:mRequest.extendedPanID.size()]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster removeNetworkWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ThreadNetworkDirectory::Commands::RemoveNetwork::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command GetOperationalDataset */ class ThreadNetworkDirectoryGetOperationalDataset : public ClusterCommand { public: ThreadNetworkDirectoryGetOperationalDataset() : ClusterCommand("get-operational-dataset") { #if MTR_ENABLE_PROVISIONAL AddArgument("ExtendedPanID", &mRequest.extendedPanID); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ThreadNetworkDirectory::Commands::GetOperationalDataset::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRThreadNetworkDirectoryClusterGetOperationalDatasetParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.extendedPanID = [NSData dataWithBytes:mRequest.extendedPanID.data() length:mRequest.extendedPanID.size()]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster getOperationalDatasetWithParams:params completion: ^(MTRThreadNetworkDirectoryClusterOperationalDatasetResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ThreadNetworkDirectory::Commands::OperationalDatasetResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ThreadNetworkDirectory::Commands::OperationalDatasetResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ThreadNetworkDirectory::Commands::GetOperationalDataset::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute PreferredExtendedPanID */ class ReadThreadNetworkDirectoryPreferredExtendedPanID : public ReadAttribute { public: ReadThreadNetworkDirectoryPreferredExtendedPanID() : ReadAttribute("preferred-extended-pan-id") { } ~ReadThreadNetworkDirectoryPreferredExtendedPanID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePreferredExtendedPanIDWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.PreferredExtendedPanID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDirectory PreferredExtendedPanID read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteThreadNetworkDirectoryPreferredExtendedPanID : public WriteAttribute { public: WriteThreadNetworkDirectoryPreferredExtendedPanID() : WriteAttribute("preferred-extended-pan-id") { AddArgument("attr-name", "preferred-extended-pan-id"); AddArgument("attr-value", &mValue); WriteAttribute::AddArguments(); } ~WriteThreadNetworkDirectoryPreferredExtendedPanID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSData * _Nullable value = nil; if (!mValue.IsNull()) { value = [[NSData alloc] initWithBytes:mValue.Value().data() length:mValue.Value().size()]; } [cluster writeAttributePreferredExtendedPanIDWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ThreadNetworkDirectory PreferredExtendedPanID write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeThreadNetworkDirectoryPreferredExtendedPanID : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDirectoryPreferredExtendedPanID() : SubscribeAttribute("preferred-extended-pan-id") { } ~SubscribeAttributeThreadNetworkDirectoryPreferredExtendedPanID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::PreferredExtendedPanID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePreferredExtendedPanIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.PreferredExtendedPanID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ThreadNetworks */ class ReadThreadNetworkDirectoryThreadNetworks : public ReadAttribute { public: ReadThreadNetworkDirectoryThreadNetworks() : ReadAttribute("thread-networks") { } ~ReadThreadNetworkDirectoryThreadNetworks() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::ThreadNetworks::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeThreadNetworksWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.ThreadNetworks response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDirectory ThreadNetworks read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDirectoryThreadNetworks : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDirectoryThreadNetworks() : SubscribeAttribute("thread-networks") { } ~SubscribeAttributeThreadNetworkDirectoryThreadNetworks() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::ThreadNetworks::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeThreadNetworksWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.ThreadNetworks response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ThreadNetworkTableSize */ class ReadThreadNetworkDirectoryThreadNetworkTableSize : public ReadAttribute { public: ReadThreadNetworkDirectoryThreadNetworkTableSize() : ReadAttribute("thread-network-table-size") { } ~ReadThreadNetworkDirectoryThreadNetworkTableSize() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::ThreadNetworkTableSize::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeThreadNetworkTableSizeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.ThreadNetworkTableSize response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDirectory ThreadNetworkTableSize read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDirectoryThreadNetworkTableSize : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDirectoryThreadNetworkTableSize() : SubscribeAttribute("thread-network-table-size") { } ~SubscribeAttributeThreadNetworkDirectoryThreadNetworkTableSize() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::ThreadNetworkTableSize::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeThreadNetworkTableSizeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.ThreadNetworkTableSize response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadThreadNetworkDirectoryGeneratedCommandList : public ReadAttribute { public: ReadThreadNetworkDirectoryGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadThreadNetworkDirectoryGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDirectory GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDirectoryGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDirectoryGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeThreadNetworkDirectoryGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadThreadNetworkDirectoryAcceptedCommandList : public ReadAttribute { public: ReadThreadNetworkDirectoryAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadThreadNetworkDirectoryAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDirectory AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDirectoryAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDirectoryAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeThreadNetworkDirectoryAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadThreadNetworkDirectoryEventList : public ReadAttribute { public: ReadThreadNetworkDirectoryEventList() : ReadAttribute("event-list") { } ~ReadThreadNetworkDirectoryEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDirectory EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDirectoryEventList : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDirectoryEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeThreadNetworkDirectoryEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadThreadNetworkDirectoryAttributeList : public ReadAttribute { public: ReadThreadNetworkDirectoryAttributeList() : ReadAttribute("attribute-list") { } ~ReadThreadNetworkDirectoryAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDirectory AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDirectoryAttributeList : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDirectoryAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeThreadNetworkDirectoryAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadThreadNetworkDirectoryFeatureMap : public ReadAttribute { public: ReadThreadNetworkDirectoryFeatureMap() : ReadAttribute("feature-map") { } ~ReadThreadNetworkDirectoryFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDirectory FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDirectoryFeatureMap : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDirectoryFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeThreadNetworkDirectoryFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadThreadNetworkDirectoryClusterRevision : public ReadAttribute { public: ReadThreadNetworkDirectoryClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadThreadNetworkDirectoryClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ThreadNetworkDirectory ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeThreadNetworkDirectoryClusterRevision : public SubscribeAttribute { public: SubscribeAttributeThreadNetworkDirectoryClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeThreadNetworkDirectoryClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ThreadNetworkDirectory::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ThreadNetworkDirectory::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterThreadNetworkDirectory alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDirectory.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster WakeOnLan | 0x0503 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * MACAddress | 0x0000 | | * LinkLocalAddress | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute MACAddress */ class ReadWakeOnLanMACAddress : public ReadAttribute { public: ReadWakeOnLanMACAddress() : ReadAttribute("macaddress") { } ~ReadWakeOnLanMACAddress() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WakeOnLan::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WakeOnLan::Attributes::MACAddress::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMACAddressWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLAN.MACAddress response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WakeOnLAN MACAddress read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWakeOnLanMACAddress : public SubscribeAttribute { public: SubscribeAttributeWakeOnLanMACAddress() : SubscribeAttribute("macaddress") { } ~SubscribeAttributeWakeOnLanMACAddress() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WakeOnLan::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WakeOnLan::Attributes::MACAddress::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMACAddressWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLAN.MACAddress response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute LinkLocalAddress */ class ReadWakeOnLanLinkLocalAddress : public ReadAttribute { public: ReadWakeOnLanLinkLocalAddress() : ReadAttribute("link-local-address") { } ~ReadWakeOnLanLinkLocalAddress() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WakeOnLan::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WakeOnLan::Attributes::LinkLocalAddress::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLinkLocalAddressWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLAN.LinkLocalAddress response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WakeOnLAN LinkLocalAddress read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWakeOnLanLinkLocalAddress : public SubscribeAttribute { public: SubscribeAttributeWakeOnLanLinkLocalAddress() : SubscribeAttribute("link-local-address") { } ~SubscribeAttributeWakeOnLanLinkLocalAddress() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WakeOnLan::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WakeOnLan::Attributes::LinkLocalAddress::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLinkLocalAddressWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLAN.LinkLocalAddress response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadWakeOnLanGeneratedCommandList : public ReadAttribute { public: ReadWakeOnLanGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadWakeOnLanGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WakeOnLan::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WakeOnLan::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLAN.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WakeOnLAN GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWakeOnLanGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeWakeOnLanGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeWakeOnLanGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WakeOnLan::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WakeOnLan::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLAN.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadWakeOnLanAcceptedCommandList : public ReadAttribute { public: ReadWakeOnLanAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadWakeOnLanAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WakeOnLan::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WakeOnLan::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLAN.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WakeOnLAN AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWakeOnLanAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeWakeOnLanAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeWakeOnLanAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WakeOnLan::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WakeOnLan::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLAN.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadWakeOnLanEventList : public ReadAttribute { public: ReadWakeOnLanEventList() : ReadAttribute("event-list") { } ~ReadWakeOnLanEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WakeOnLan::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WakeOnLan::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLAN.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WakeOnLAN EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWakeOnLanEventList : public SubscribeAttribute { public: SubscribeAttributeWakeOnLanEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeWakeOnLanEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WakeOnLan::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WakeOnLan::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLAN.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadWakeOnLanAttributeList : public ReadAttribute { public: ReadWakeOnLanAttributeList() : ReadAttribute("attribute-list") { } ~ReadWakeOnLanAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WakeOnLan::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WakeOnLan::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLAN.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WakeOnLAN AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWakeOnLanAttributeList : public SubscribeAttribute { public: SubscribeAttributeWakeOnLanAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeWakeOnLanAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WakeOnLan::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WakeOnLan::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLAN.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadWakeOnLanFeatureMap : public ReadAttribute { public: ReadWakeOnLanFeatureMap() : ReadAttribute("feature-map") { } ~ReadWakeOnLanFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WakeOnLan::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WakeOnLan::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLAN.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WakeOnLAN FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWakeOnLanFeatureMap : public SubscribeAttribute { public: SubscribeAttributeWakeOnLanFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeWakeOnLanFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WakeOnLan::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WakeOnLan::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLAN.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadWakeOnLanClusterRevision : public ReadAttribute { public: ReadWakeOnLanClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadWakeOnLanClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WakeOnLan::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WakeOnLan::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLAN.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WakeOnLAN ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWakeOnLanClusterRevision : public SubscribeAttribute { public: SubscribeAttributeWakeOnLanClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeWakeOnLanClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WakeOnLan::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WakeOnLan::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWakeOnLAN alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLAN.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster Channel | 0x0504 | |------------------------------------------------------------------------------| | Commands: | | | * ChangeChannel | 0x00 | | * ChangeChannelByNumber | 0x02 | | * SkipChannel | 0x03 | | * GetProgramGuide | 0x04 | | * RecordProgram | 0x06 | | * CancelRecordProgram | 0x07 | |------------------------------------------------------------------------------| | Attributes: | | | * ChannelList | 0x0000 | | * Lineup | 0x0001 | | * CurrentChannel | 0x0002 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command ChangeChannel */ class ChannelChangeChannel : public ClusterCommand { public: ChannelChangeChannel() : ClusterCommand("change-channel") { AddArgument("Match", &mRequest.match); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Channel::Commands::ChangeChannel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRChannelClusterChangeChannelParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.match = [[NSString alloc] initWithBytes:mRequest.match.data() length:mRequest.match.size() encoding:NSUTF8StringEncoding]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster changeChannelWithParams:params completion: ^(MTRChannelClusterChangeChannelResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::Channel::Commands::ChangeChannelResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::Channel::Commands::ChangeChannelResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Channel::Commands::ChangeChannel::Type mRequest; }; /* * Command ChangeChannelByNumber */ class ChannelChangeChannelByNumber : public ClusterCommand { public: ChannelChangeChannelByNumber() : ClusterCommand("change-channel-by-number") { AddArgument("MajorNumber", 0, UINT16_MAX, &mRequest.majorNumber); AddArgument("MinorNumber", 0, UINT16_MAX, &mRequest.minorNumber); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRChannelClusterChangeChannelByNumberParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.majorNumber = [NSNumber numberWithUnsignedShort:mRequest.majorNumber]; params.minorNumber = [NSNumber numberWithUnsignedShort:mRequest.minorNumber]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster changeChannelByNumberWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Channel::Commands::ChangeChannelByNumber::Type mRequest; }; /* * Command SkipChannel */ class ChannelSkipChannel : public ClusterCommand { public: ChannelSkipChannel() : ClusterCommand("skip-channel") { AddArgument("Count", INT16_MIN, INT16_MAX, &mRequest.count); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Channel::Commands::SkipChannel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRChannelClusterSkipChannelParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.count = [NSNumber numberWithShort:mRequest.count]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster skipChannelWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Channel::Commands::SkipChannel::Type mRequest; }; #if MTR_ENABLE_PROVISIONAL /* * Command GetProgramGuide */ class ChannelGetProgramGuide : public ClusterCommand { public: ChannelGetProgramGuide() : ClusterCommand("get-program-guide") , mComplex_ChannelList(&mRequest.channelList) , mComplex_PageToken(&mRequest.pageToken) , mComplex_ExternalIDList(&mRequest.externalIDList) { #if MTR_ENABLE_PROVISIONAL AddArgument("StartTime", 0, UINT32_MAX, &mRequest.startTime); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("EndTime", 0, UINT32_MAX, &mRequest.endTime); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ChannelList", &mComplex_ChannelList); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("PageToken", &mComplex_PageToken); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("RecordingFlag", 0, UINT32_MAX, &mRequest.recordingFlag); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ExternalIDList", &mComplex_ExternalIDList); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Data", &mRequest.data); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Channel::Commands::GetProgramGuide::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRChannelClusterGetProgramGuideParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.startTime.HasValue()) { params.startTime = [NSNumber numberWithUnsignedInt:mRequest.startTime.Value()]; } else { params.startTime = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.endTime.HasValue()) { params.endTime = [NSNumber numberWithUnsignedInt:mRequest.endTime.Value()]; } else { params.endTime = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.channelList.HasValue()) { { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.channelList.Value()) { MTRChannelClusterChannelInfoStruct * newElement_1; newElement_1 = [MTRChannelClusterChannelInfoStruct new]; newElement_1.majorNumber = [NSNumber numberWithUnsignedShort:entry_1.majorNumber]; newElement_1.minorNumber = [NSNumber numberWithUnsignedShort:entry_1.minorNumber]; if (entry_1.name.HasValue()) { newElement_1.name = [[NSString alloc] initWithBytes:entry_1.name.Value().data() length:entry_1.name.Value().size() encoding:NSUTF8StringEncoding]; } else { newElement_1.name = nil; } if (entry_1.callSign.HasValue()) { newElement_1.callSign = [[NSString alloc] initWithBytes:entry_1.callSign.Value().data() length:entry_1.callSign.Value().size() encoding:NSUTF8StringEncoding]; } else { newElement_1.callSign = nil; } if (entry_1.affiliateCallSign.HasValue()) { newElement_1.affiliateCallSign = [[NSString alloc] initWithBytes:entry_1.affiliateCallSign.Value().data() length:entry_1.affiliateCallSign.Value().size() encoding:NSUTF8StringEncoding]; } else { newElement_1.affiliateCallSign = nil; } if (entry_1.identifier.HasValue()) { newElement_1.identifier = [[NSString alloc] initWithBytes:entry_1.identifier.Value().data() length:entry_1.identifier.Value().size() encoding:NSUTF8StringEncoding]; } else { newElement_1.identifier = nil; } if (entry_1.type.HasValue()) { newElement_1.type = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1.type.Value())]; } else { newElement_1.type = nil; } [array_1 addObject:newElement_1]; } params.channelList = array_1; } } else { params.channelList = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.pageToken.HasValue()) { params.pageToken = [MTRChannelClusterPageTokenStruct new]; if (mRequest.pageToken.Value().limit.HasValue()) { params.pageToken.limit = [NSNumber numberWithUnsignedShort:mRequest.pageToken.Value().limit.Value()]; } else { params.pageToken.limit = nil; } if (mRequest.pageToken.Value().after.HasValue()) { params.pageToken.after = [[NSString alloc] initWithBytes:mRequest.pageToken.Value().after.Value().data() length:mRequest.pageToken.Value().after.Value().size() encoding:NSUTF8StringEncoding]; } else { params.pageToken.after = nil; } if (mRequest.pageToken.Value().before.HasValue()) { params.pageToken.before = [[NSString alloc] initWithBytes:mRequest.pageToken.Value().before.Value().data() length:mRequest.pageToken.Value().before.Value().size() encoding:NSUTF8StringEncoding]; } else { params.pageToken.before = nil; } } else { params.pageToken = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.recordingFlag.HasValue()) { params.recordingFlag = [NSNumber numberWithUnsignedInt:mRequest.recordingFlag.Value().Raw()]; } else { params.recordingFlag = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.externalIDList.HasValue()) { { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.externalIDList.Value()) { MTRChannelClusterAdditionalInfoStruct * newElement_1; newElement_1 = [MTRChannelClusterAdditionalInfoStruct new]; newElement_1.name = [[NSString alloc] initWithBytes:entry_1.name.data() length:entry_1.name.size() encoding:NSUTF8StringEncoding]; newElement_1.value = [[NSString alloc] initWithBytes:entry_1.value.data() length:entry_1.value.size() encoding:NSUTF8StringEncoding]; [array_1 addObject:newElement_1]; } params.externalIDList = array_1; } } else { params.externalIDList = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.data.HasValue()) { params.data = [NSData dataWithBytes:mRequest.data.Value().data() length:mRequest.data.Value().size()]; } else { params.data = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster getProgramGuideWithParams:params completion: ^(MTRChannelClusterProgramGuideResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::Channel::Commands::ProgramGuideResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::Channel::Commands::ProgramGuideResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Channel::Commands::GetProgramGuide::Type mRequest; TypedComplexArgument>> mComplex_ChannelList; TypedComplexArgument> mComplex_PageToken; TypedComplexArgument>> mComplex_ExternalIDList; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command RecordProgram */ class ChannelRecordProgram : public ClusterCommand { public: ChannelRecordProgram() : ClusterCommand("record-program") , mComplex_ExternalIDList(&mRequest.externalIDList) { #if MTR_ENABLE_PROVISIONAL AddArgument("ProgramIdentifier", &mRequest.programIdentifier); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ShouldRecordSeries", 0, 1, &mRequest.shouldRecordSeries); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ExternalIDList", &mComplex_ExternalIDList); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Data", &mRequest.data); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Channel::Commands::RecordProgram::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRChannelClusterRecordProgramParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.programIdentifier = [[NSString alloc] initWithBytes:mRequest.programIdentifier.data() length:mRequest.programIdentifier.size() encoding:NSUTF8StringEncoding]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.shouldRecordSeries = [NSNumber numberWithBool:mRequest.shouldRecordSeries]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.externalIDList) { MTRChannelClusterAdditionalInfoStruct * newElement_0; newElement_0 = [MTRChannelClusterAdditionalInfoStruct new]; newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.data() length:entry_0.name.size() encoding:NSUTF8StringEncoding]; newElement_0.value = [[NSString alloc] initWithBytes:entry_0.value.data() length:entry_0.value.size() encoding:NSUTF8StringEncoding]; [array_0 addObject:newElement_0]; } params.externalIDList = array_0; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.data = [NSData dataWithBytes:mRequest.data.data() length:mRequest.data.size()]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster recordProgramWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Channel::Commands::RecordProgram::Type mRequest; TypedComplexArgument> mComplex_ExternalIDList; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command CancelRecordProgram */ class ChannelCancelRecordProgram : public ClusterCommand { public: ChannelCancelRecordProgram() : ClusterCommand("cancel-record-program") , mComplex_ExternalIDList(&mRequest.externalIDList) { #if MTR_ENABLE_PROVISIONAL AddArgument("ProgramIdentifier", &mRequest.programIdentifier); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ShouldRecordSeries", 0, 1, &mRequest.shouldRecordSeries); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ExternalIDList", &mComplex_ExternalIDList); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Data", &mRequest.data); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Channel::Commands::CancelRecordProgram::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRChannelClusterCancelRecordProgramParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.programIdentifier = [[NSString alloc] initWithBytes:mRequest.programIdentifier.data() length:mRequest.programIdentifier.size() encoding:NSUTF8StringEncoding]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.shouldRecordSeries = [NSNumber numberWithBool:mRequest.shouldRecordSeries]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.externalIDList) { MTRChannelClusterAdditionalInfoStruct * newElement_0; newElement_0 = [MTRChannelClusterAdditionalInfoStruct new]; newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.data() length:entry_0.name.size() encoding:NSUTF8StringEncoding]; newElement_0.value = [[NSString alloc] initWithBytes:entry_0.value.data() length:entry_0.value.size() encoding:NSUTF8StringEncoding]; [array_0 addObject:newElement_0]; } params.externalIDList = array_0; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.data = [NSData dataWithBytes:mRequest.data.data() length:mRequest.data.size()]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster cancelRecordProgramWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::Channel::Commands::CancelRecordProgram::Type mRequest; TypedComplexArgument> mComplex_ExternalIDList; }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute ChannelList */ class ReadChannelChannelList : public ReadAttribute { public: ReadChannelChannelList() : ReadAttribute("channel-list") { } ~ReadChannelChannelList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Channel::Attributes::ChannelList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeChannelListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.ChannelList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Channel ChannelList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeChannelChannelList : public SubscribeAttribute { public: SubscribeAttributeChannelChannelList() : SubscribeAttribute("channel-list") { } ~SubscribeAttributeChannelChannelList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Channel::Attributes::ChannelList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeChannelListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.ChannelList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Lineup */ class ReadChannelLineup : public ReadAttribute { public: ReadChannelLineup() : ReadAttribute("lineup") { } ~ReadChannelLineup() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Channel::Attributes::Lineup::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLineupWithCompletion:^(MTRChannelClusterLineupInfoStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.Lineup response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Channel Lineup read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeChannelLineup : public SubscribeAttribute { public: SubscribeAttributeChannelLineup() : SubscribeAttribute("lineup") { } ~SubscribeAttributeChannelLineup() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Channel::Attributes::Lineup::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLineupWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRChannelClusterLineupInfoStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.Lineup response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentChannel */ class ReadChannelCurrentChannel : public ReadAttribute { public: ReadChannelCurrentChannel() : ReadAttribute("current-channel") { } ~ReadChannelCurrentChannel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Channel::Attributes::CurrentChannel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentChannelWithCompletion:^(MTRChannelClusterChannelInfoStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.CurrentChannel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Channel CurrentChannel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeChannelCurrentChannel : public SubscribeAttribute { public: SubscribeAttributeChannelCurrentChannel() : SubscribeAttribute("current-channel") { } ~SubscribeAttributeChannelCurrentChannel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Channel::Attributes::CurrentChannel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentChannelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRChannelClusterChannelInfoStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.CurrentChannel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadChannelGeneratedCommandList : public ReadAttribute { public: ReadChannelGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadChannelGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Channel::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Channel GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeChannelGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeChannelGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeChannelGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Channel::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadChannelAcceptedCommandList : public ReadAttribute { public: ReadChannelAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadChannelAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Channel::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Channel AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeChannelAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeChannelAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeChannelAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Channel::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadChannelEventList : public ReadAttribute { public: ReadChannelEventList() : ReadAttribute("event-list") { } ~ReadChannelEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Channel::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Channel EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeChannelEventList : public SubscribeAttribute { public: SubscribeAttributeChannelEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeChannelEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Channel::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadChannelAttributeList : public ReadAttribute { public: ReadChannelAttributeList() : ReadAttribute("attribute-list") { } ~ReadChannelAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Channel::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Channel AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeChannelAttributeList : public SubscribeAttribute { public: SubscribeAttributeChannelAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeChannelAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Channel::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadChannelFeatureMap : public ReadAttribute { public: ReadChannelFeatureMap() : ReadAttribute("feature-map") { } ~ReadChannelFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Channel::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Channel FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeChannelFeatureMap : public SubscribeAttribute { public: SubscribeAttributeChannelFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeChannelFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Channel::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadChannelClusterRevision : public ReadAttribute { public: ReadChannelClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadChannelClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Channel::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Channel ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeChannelClusterRevision : public SubscribeAttribute { public: SubscribeAttributeChannelClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeChannelClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Channel::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Channel::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster TargetNavigator | 0x0505 | |------------------------------------------------------------------------------| | Commands: | | | * NavigateTarget | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * TargetList | 0x0000 | | * CurrentTarget | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * TargetUpdated | 0x0000 | \*----------------------------------------------------------------------------*/ /* * Command NavigateTarget */ class TargetNavigatorNavigateTarget : public ClusterCommand { public: TargetNavigatorNavigateTarget() : ClusterCommand("navigate-target") { AddArgument("Target", 0, UINT8_MAX, &mRequest.target); AddArgument("Data", &mRequest.data); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::CommandId commandId = chip::app::Clusters::TargetNavigator::Commands::NavigateTarget::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRTargetNavigatorClusterNavigateTargetParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.target = [NSNumber numberWithUnsignedChar:mRequest.target]; if (mRequest.data.HasValue()) { params.data = [[NSString alloc] initWithBytes:mRequest.data.Value().data() length:mRequest.data.Value().size() encoding:NSUTF8StringEncoding]; } else { params.data = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster navigateTargetWithParams:params completion: ^(MTRTargetNavigatorClusterNavigateTargetResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::TargetNavigator::Commands::NavigateTargetResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::TargetNavigator::Commands::NavigateTargetResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::TargetNavigator::Commands::NavigateTarget::Type mRequest; }; /* * Attribute TargetList */ class ReadTargetNavigatorTargetList : public ReadAttribute { public: ReadTargetNavigatorTargetList() : ReadAttribute("target-list") { } ~ReadTargetNavigatorTargetList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TargetNavigator::Attributes::TargetList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTargetListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.TargetList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TargetNavigator TargetList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTargetNavigatorTargetList : public SubscribeAttribute { public: SubscribeAttributeTargetNavigatorTargetList() : SubscribeAttribute("target-list") { } ~SubscribeAttributeTargetNavigatorTargetList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TargetNavigator::Attributes::TargetList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTargetListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.TargetList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentTarget */ class ReadTargetNavigatorCurrentTarget : public ReadAttribute { public: ReadTargetNavigatorCurrentTarget() : ReadAttribute("current-target") { } ~ReadTargetNavigatorCurrentTarget() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TargetNavigator::Attributes::CurrentTarget::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentTargetWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.CurrentTarget response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TargetNavigator CurrentTarget read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTargetNavigatorCurrentTarget : public SubscribeAttribute { public: SubscribeAttributeTargetNavigatorCurrentTarget() : SubscribeAttribute("current-target") { } ~SubscribeAttributeTargetNavigatorCurrentTarget() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TargetNavigator::Attributes::CurrentTarget::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentTargetWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.CurrentTarget response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadTargetNavigatorGeneratedCommandList : public ReadAttribute { public: ReadTargetNavigatorGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadTargetNavigatorGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TargetNavigator::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TargetNavigator GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTargetNavigatorGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeTargetNavigatorGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeTargetNavigatorGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TargetNavigator::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadTargetNavigatorAcceptedCommandList : public ReadAttribute { public: ReadTargetNavigatorAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadTargetNavigatorAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TargetNavigator::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TargetNavigator AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTargetNavigatorAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeTargetNavigatorAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeTargetNavigatorAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TargetNavigator::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadTargetNavigatorEventList : public ReadAttribute { public: ReadTargetNavigatorEventList() : ReadAttribute("event-list") { } ~ReadTargetNavigatorEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TargetNavigator::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TargetNavigator EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTargetNavigatorEventList : public SubscribeAttribute { public: SubscribeAttributeTargetNavigatorEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeTargetNavigatorEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TargetNavigator::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadTargetNavigatorAttributeList : public ReadAttribute { public: ReadTargetNavigatorAttributeList() : ReadAttribute("attribute-list") { } ~ReadTargetNavigatorAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TargetNavigator::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TargetNavigator AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTargetNavigatorAttributeList : public SubscribeAttribute { public: SubscribeAttributeTargetNavigatorAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeTargetNavigatorAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TargetNavigator::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadTargetNavigatorFeatureMap : public ReadAttribute { public: ReadTargetNavigatorFeatureMap() : ReadAttribute("feature-map") { } ~ReadTargetNavigatorFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TargetNavigator::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TargetNavigator FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTargetNavigatorFeatureMap : public SubscribeAttribute { public: SubscribeAttributeTargetNavigatorFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeTargetNavigatorFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TargetNavigator::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadTargetNavigatorClusterRevision : public ReadAttribute { public: ReadTargetNavigatorClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadTargetNavigatorClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::TargetNavigator::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("TargetNavigator ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeTargetNavigatorClusterRevision : public SubscribeAttribute { public: SubscribeAttributeTargetNavigatorClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeTargetNavigatorClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::TargetNavigator::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::TargetNavigator::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster MediaPlayback | 0x0506 | |------------------------------------------------------------------------------| | Commands: | | | * Play | 0x00 | | * Pause | 0x01 | | * Stop | 0x02 | | * StartOver | 0x03 | | * Previous | 0x04 | | * Next | 0x05 | | * Rewind | 0x06 | | * FastForward | 0x07 | | * SkipForward | 0x08 | | * SkipBackward | 0x09 | | * Seek | 0x0B | | * ActivateAudioTrack | 0x0C | | * ActivateTextTrack | 0x0D | | * DeactivateTextTrack | 0x0E | |------------------------------------------------------------------------------| | Attributes: | | | * CurrentState | 0x0000 | | * StartTime | 0x0001 | | * Duration | 0x0002 | | * SampledPosition | 0x0003 | | * PlaybackSpeed | 0x0004 | | * SeekRangeEnd | 0x0005 | | * SeekRangeStart | 0x0006 | | * ActiveAudioTrack | 0x0007 | | * AvailableAudioTracks | 0x0008 | | * ActiveTextTrack | 0x0009 | | * AvailableTextTracks | 0x000A | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * StateChanged | 0x0000 | \*----------------------------------------------------------------------------*/ /* * Command Play */ class MediaPlaybackPlay : public ClusterCommand { public: MediaPlaybackPlay() : ClusterCommand("play") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaPlayback::Commands::Play::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaPlaybackClusterPlayParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster playWithParams:params completion: ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command Pause */ class MediaPlaybackPause : public ClusterCommand { public: MediaPlaybackPause() : ClusterCommand("pause") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaPlayback::Commands::Pause::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaPlaybackClusterPauseParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster pauseWithParams:params completion: ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command Stop */ class MediaPlaybackStop : public ClusterCommand { public: MediaPlaybackStop() : ClusterCommand("stop") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaPlayback::Commands::Stop::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaPlaybackClusterStopParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stopWithParams:params completion: ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command StartOver */ class MediaPlaybackStartOver : public ClusterCommand { public: MediaPlaybackStartOver() : ClusterCommand("start-over") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaPlayback::Commands::StartOver::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaPlaybackClusterStartOverParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster startOverWithParams:params completion: ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command Previous */ class MediaPlaybackPrevious : public ClusterCommand { public: MediaPlaybackPrevious() : ClusterCommand("previous") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaPlayback::Commands::Previous::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaPlaybackClusterPreviousParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster previousWithParams:params completion: ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command Next */ class MediaPlaybackNext : public ClusterCommand { public: MediaPlaybackNext() : ClusterCommand("next") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaPlayback::Commands::Next::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaPlaybackClusterNextParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster nextWithParams:params completion: ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command Rewind */ class MediaPlaybackRewind : public ClusterCommand { public: MediaPlaybackRewind() : ClusterCommand("rewind") { #if MTR_ENABLE_PROVISIONAL AddArgument("AudioAdvanceUnmuted", 0, 1, &mRequest.audioAdvanceUnmuted); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaPlayback::Commands::Rewind::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaPlaybackClusterRewindParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.audioAdvanceUnmuted.HasValue()) { params.audioAdvanceUnmuted = [NSNumber numberWithBool:mRequest.audioAdvanceUnmuted.Value()]; } else { params.audioAdvanceUnmuted = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster rewindWithParams:params completion: ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::MediaPlayback::Commands::Rewind::Type mRequest; }; /* * Command FastForward */ class MediaPlaybackFastForward : public ClusterCommand { public: MediaPlaybackFastForward() : ClusterCommand("fast-forward") { #if MTR_ENABLE_PROVISIONAL AddArgument("AudioAdvanceUnmuted", 0, 1, &mRequest.audioAdvanceUnmuted); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaPlayback::Commands::FastForward::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaPlaybackClusterFastForwardParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.audioAdvanceUnmuted.HasValue()) { params.audioAdvanceUnmuted = [NSNumber numberWithBool:mRequest.audioAdvanceUnmuted.Value()]; } else { params.audioAdvanceUnmuted = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster fastForwardWithParams:params completion: ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::MediaPlayback::Commands::FastForward::Type mRequest; }; /* * Command SkipForward */ class MediaPlaybackSkipForward : public ClusterCommand { public: MediaPlaybackSkipForward() : ClusterCommand("skip-forward") { AddArgument("DeltaPositionMilliseconds", 0, UINT64_MAX, &mRequest.deltaPositionMilliseconds); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaPlayback::Commands::SkipForward::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaPlaybackClusterSkipForwardParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.deltaPositionMilliseconds = [NSNumber numberWithUnsignedLongLong:mRequest.deltaPositionMilliseconds]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster skipForwardWithParams:params completion: ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::MediaPlayback::Commands::SkipForward::Type mRequest; }; /* * Command SkipBackward */ class MediaPlaybackSkipBackward : public ClusterCommand { public: MediaPlaybackSkipBackward() : ClusterCommand("skip-backward") { AddArgument("DeltaPositionMilliseconds", 0, UINT64_MAX, &mRequest.deltaPositionMilliseconds); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaPlayback::Commands::SkipBackward::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaPlaybackClusterSkipBackwardParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.deltaPositionMilliseconds = [NSNumber numberWithUnsignedLongLong:mRequest.deltaPositionMilliseconds]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster skipBackwardWithParams:params completion: ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::MediaPlayback::Commands::SkipBackward::Type mRequest; }; /* * Command Seek */ class MediaPlaybackSeek : public ClusterCommand { public: MediaPlaybackSeek() : ClusterCommand("seek") { AddArgument("Position", 0, UINT64_MAX, &mRequest.position); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaPlayback::Commands::Seek::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaPlaybackClusterSeekParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.position = [NSNumber numberWithUnsignedLongLong:mRequest.position]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster seekWithParams:params completion: ^(MTRMediaPlaybackClusterPlaybackResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::MediaPlayback::Commands::PlaybackResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::MediaPlayback::Commands::Seek::Type mRequest; }; #if MTR_ENABLE_PROVISIONAL /* * Command ActivateAudioTrack */ class MediaPlaybackActivateAudioTrack : public ClusterCommand { public: MediaPlaybackActivateAudioTrack() : ClusterCommand("activate-audio-track") { #if MTR_ENABLE_PROVISIONAL AddArgument("TrackID", &mRequest.trackID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("AudioOutputIndex", 0, UINT8_MAX, &mRequest.audioOutputIndex); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaPlayback::Commands::ActivateAudioTrack::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaPlaybackClusterActivateAudioTrackParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.trackID = [[NSString alloc] initWithBytes:mRequest.trackID.data() length:mRequest.trackID.size() encoding:NSUTF8StringEncoding]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.audioOutputIndex = [NSNumber numberWithUnsignedChar:mRequest.audioOutputIndex]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster activateAudioTrackWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::MediaPlayback::Commands::ActivateAudioTrack::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command ActivateTextTrack */ class MediaPlaybackActivateTextTrack : public ClusterCommand { public: MediaPlaybackActivateTextTrack() : ClusterCommand("activate-text-track") { #if MTR_ENABLE_PROVISIONAL AddArgument("TrackID", &mRequest.trackID); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaPlayback::Commands::ActivateTextTrack::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaPlaybackClusterActivateTextTrackParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.trackID = [[NSString alloc] initWithBytes:mRequest.trackID.data() length:mRequest.trackID.size() encoding:NSUTF8StringEncoding]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster activateTextTrackWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::MediaPlayback::Commands::ActivateTextTrack::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command DeactivateTextTrack */ class MediaPlaybackDeactivateTextTrack : public ClusterCommand { public: MediaPlaybackDeactivateTextTrack() : ClusterCommand("deactivate-text-track") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaPlayback::Commands::DeactivateTextTrack::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaPlaybackClusterDeactivateTextTrackParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster deactivateTextTrackWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute CurrentState */ class ReadMediaPlaybackCurrentState : public ReadAttribute { public: ReadMediaPlaybackCurrentState() : ReadAttribute("current-state") { } ~ReadMediaPlaybackCurrentState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::CurrentState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.CurrentState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback CurrentState read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackCurrentState : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackCurrentState() : SubscribeAttribute("current-state") { } ~SubscribeAttributeMediaPlaybackCurrentState() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::CurrentState::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentStateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.CurrentState response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute StartTime */ class ReadMediaPlaybackStartTime : public ReadAttribute { public: ReadMediaPlaybackStartTime() : ReadAttribute("start-time") { } ~ReadMediaPlaybackStartTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::StartTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStartTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.StartTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback StartTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackStartTime : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackStartTime() : SubscribeAttribute("start-time") { } ~SubscribeAttributeMediaPlaybackStartTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::StartTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStartTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.StartTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Duration */ class ReadMediaPlaybackDuration : public ReadAttribute { public: ReadMediaPlaybackDuration() : ReadAttribute("duration") { } ~ReadMediaPlaybackDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::Duration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDurationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.Duration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback Duration read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackDuration : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackDuration() : SubscribeAttribute("duration") { } ~SubscribeAttributeMediaPlaybackDuration() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::Duration::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDurationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.Duration response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SampledPosition */ class ReadMediaPlaybackSampledPosition : public ReadAttribute { public: ReadMediaPlaybackSampledPosition() : ReadAttribute("sampled-position") { } ~ReadMediaPlaybackSampledPosition() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::SampledPosition::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSampledPositionWithCompletion:^(MTRMediaPlaybackClusterPlaybackPositionStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.SampledPosition response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback SampledPosition read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackSampledPosition : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackSampledPosition() : SubscribeAttribute("sampled-position") { } ~SubscribeAttributeMediaPlaybackSampledPosition() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::SampledPosition::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSampledPositionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRMediaPlaybackClusterPlaybackPositionStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.SampledPosition response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute PlaybackSpeed */ class ReadMediaPlaybackPlaybackSpeed : public ReadAttribute { public: ReadMediaPlaybackPlaybackSpeed() : ReadAttribute("playback-speed") { } ~ReadMediaPlaybackPlaybackSpeed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::PlaybackSpeed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributePlaybackSpeedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.PlaybackSpeed response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback PlaybackSpeed read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackPlaybackSpeed : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackPlaybackSpeed() : SubscribeAttribute("playback-speed") { } ~SubscribeAttributeMediaPlaybackPlaybackSpeed() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::PlaybackSpeed::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributePlaybackSpeedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.PlaybackSpeed response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SeekRangeEnd */ class ReadMediaPlaybackSeekRangeEnd : public ReadAttribute { public: ReadMediaPlaybackSeekRangeEnd() : ReadAttribute("seek-range-end") { } ~ReadMediaPlaybackSeekRangeEnd() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::SeekRangeEnd::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSeekRangeEndWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.SeekRangeEnd response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback SeekRangeEnd read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackSeekRangeEnd : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackSeekRangeEnd() : SubscribeAttribute("seek-range-end") { } ~SubscribeAttributeMediaPlaybackSeekRangeEnd() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::SeekRangeEnd::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSeekRangeEndWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.SeekRangeEnd response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SeekRangeStart */ class ReadMediaPlaybackSeekRangeStart : public ReadAttribute { public: ReadMediaPlaybackSeekRangeStart() : ReadAttribute("seek-range-start") { } ~ReadMediaPlaybackSeekRangeStart() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::SeekRangeStart::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSeekRangeStartWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.SeekRangeStart response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback SeekRangeStart read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackSeekRangeStart : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackSeekRangeStart() : SubscribeAttribute("seek-range-start") { } ~SubscribeAttributeMediaPlaybackSeekRangeStart() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::SeekRangeStart::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSeekRangeStartWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.SeekRangeStart response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute ActiveAudioTrack */ class ReadMediaPlaybackActiveAudioTrack : public ReadAttribute { public: ReadMediaPlaybackActiveAudioTrack() : ReadAttribute("active-audio-track") { } ~ReadMediaPlaybackActiveAudioTrack() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::ActiveAudioTrack::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveAudioTrackWithCompletion:^(MTRMediaPlaybackClusterTrackStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.ActiveAudioTrack response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback ActiveAudioTrack read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackActiveAudioTrack : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackActiveAudioTrack() : SubscribeAttribute("active-audio-track") { } ~SubscribeAttributeMediaPlaybackActiveAudioTrack() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::ActiveAudioTrack::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveAudioTrackWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRMediaPlaybackClusterTrackStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.ActiveAudioTrack response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AvailableAudioTracks */ class ReadMediaPlaybackAvailableAudioTracks : public ReadAttribute { public: ReadMediaPlaybackAvailableAudioTracks() : ReadAttribute("available-audio-tracks") { } ~ReadMediaPlaybackAvailableAudioTracks() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::AvailableAudioTracks::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAvailableAudioTracksWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.AvailableAudioTracks response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback AvailableAudioTracks read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackAvailableAudioTracks : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackAvailableAudioTracks() : SubscribeAttribute("available-audio-tracks") { } ~SubscribeAttributeMediaPlaybackAvailableAudioTracks() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::AvailableAudioTracks::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAvailableAudioTracksWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.AvailableAudioTracks response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ActiveTextTrack */ class ReadMediaPlaybackActiveTextTrack : public ReadAttribute { public: ReadMediaPlaybackActiveTextTrack() : ReadAttribute("active-text-track") { } ~ReadMediaPlaybackActiveTextTrack() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::ActiveTextTrack::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveTextTrackWithCompletion:^(MTRMediaPlaybackClusterTrackStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.ActiveTextTrack response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback ActiveTextTrack read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackActiveTextTrack : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackActiveTextTrack() : SubscribeAttribute("active-text-track") { } ~SubscribeAttributeMediaPlaybackActiveTextTrack() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::ActiveTextTrack::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveTextTrackWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRMediaPlaybackClusterTrackStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.ActiveTextTrack response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AvailableTextTracks */ class ReadMediaPlaybackAvailableTextTracks : public ReadAttribute { public: ReadMediaPlaybackAvailableTextTracks() : ReadAttribute("available-text-tracks") { } ~ReadMediaPlaybackAvailableTextTracks() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::AvailableTextTracks::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAvailableTextTracksWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.AvailableTextTracks response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback AvailableTextTracks read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackAvailableTextTracks : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackAvailableTextTracks() : SubscribeAttribute("available-text-tracks") { } ~SubscribeAttributeMediaPlaybackAvailableTextTracks() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::AvailableTextTracks::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAvailableTextTracksWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.AvailableTextTracks response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadMediaPlaybackGeneratedCommandList : public ReadAttribute { public: ReadMediaPlaybackGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadMediaPlaybackGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeMediaPlaybackGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadMediaPlaybackAcceptedCommandList : public ReadAttribute { public: ReadMediaPlaybackAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadMediaPlaybackAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeMediaPlaybackAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadMediaPlaybackEventList : public ReadAttribute { public: ReadMediaPlaybackEventList() : ReadAttribute("event-list") { } ~ReadMediaPlaybackEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackEventList : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeMediaPlaybackEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadMediaPlaybackAttributeList : public ReadAttribute { public: ReadMediaPlaybackAttributeList() : ReadAttribute("attribute-list") { } ~ReadMediaPlaybackAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackAttributeList : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeMediaPlaybackAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadMediaPlaybackFeatureMap : public ReadAttribute { public: ReadMediaPlaybackFeatureMap() : ReadAttribute("feature-map") { } ~ReadMediaPlaybackFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackFeatureMap : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeMediaPlaybackFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadMediaPlaybackClusterRevision : public ReadAttribute { public: ReadMediaPlaybackClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadMediaPlaybackClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaPlayback::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaPlayback ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaPlaybackClusterRevision : public SubscribeAttribute { public: SubscribeAttributeMediaPlaybackClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeMediaPlaybackClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaPlayback::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaPlayback::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster MediaInput | 0x0507 | |------------------------------------------------------------------------------| | Commands: | | | * SelectInput | 0x00 | | * ShowInputStatus | 0x01 | | * HideInputStatus | 0x02 | | * RenameInput | 0x03 | |------------------------------------------------------------------------------| | Attributes: | | | * InputList | 0x0000 | | * CurrentInput | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command SelectInput */ class MediaInputSelectInput : public ClusterCommand { public: MediaInputSelectInput() : ClusterCommand("select-input") { AddArgument("Index", 0, UINT8_MAX, &mRequest.index); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaInput::Commands::SelectInput::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaInputClusterSelectInputParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.index = [NSNumber numberWithUnsignedChar:mRequest.index]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster selectInputWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::MediaInput::Commands::SelectInput::Type mRequest; }; /* * Command ShowInputStatus */ class MediaInputShowInputStatus : public ClusterCommand { public: MediaInputShowInputStatus() : ClusterCommand("show-input-status") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaInput::Commands::ShowInputStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaInputClusterShowInputStatusParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster showInputStatusWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command HideInputStatus */ class MediaInputHideInputStatus : public ClusterCommand { public: MediaInputHideInputStatus() : ClusterCommand("hide-input-status") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaInput::Commands::HideInputStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaInputClusterHideInputStatusParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster hideInputStatusWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command RenameInput */ class MediaInputRenameInput : public ClusterCommand { public: MediaInputRenameInput() : ClusterCommand("rename-input") { AddArgument("Index", 0, UINT8_MAX, &mRequest.index); AddArgument("Name", &mRequest.name); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::CommandId commandId = chip::app::Clusters::MediaInput::Commands::RenameInput::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRMediaInputClusterRenameInputParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.index = [NSNumber numberWithUnsignedChar:mRequest.index]; params.name = [[NSString alloc] initWithBytes:mRequest.name.data() length:mRequest.name.size() encoding:NSUTF8StringEncoding]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster renameInputWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::MediaInput::Commands::RenameInput::Type mRequest; }; /* * Attribute InputList */ class ReadMediaInputInputList : public ReadAttribute { public: ReadMediaInputInputList() : ReadAttribute("input-list") { } ~ReadMediaInputInputList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaInput::Attributes::InputList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInputListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.InputList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaInput InputList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaInputInputList : public SubscribeAttribute { public: SubscribeAttributeMediaInputInputList() : SubscribeAttribute("input-list") { } ~SubscribeAttributeMediaInputInputList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaInput::Attributes::InputList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInputListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.InputList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentInput */ class ReadMediaInputCurrentInput : public ReadAttribute { public: ReadMediaInputCurrentInput() : ReadAttribute("current-input") { } ~ReadMediaInputCurrentInput() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaInput::Attributes::CurrentInput::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentInputWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.CurrentInput response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaInput CurrentInput read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaInputCurrentInput : public SubscribeAttribute { public: SubscribeAttributeMediaInputCurrentInput() : SubscribeAttribute("current-input") { } ~SubscribeAttributeMediaInputCurrentInput() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaInput::Attributes::CurrentInput::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentInputWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.CurrentInput response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadMediaInputGeneratedCommandList : public ReadAttribute { public: ReadMediaInputGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadMediaInputGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaInput::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaInput GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaInputGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeMediaInputGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeMediaInputGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaInput::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadMediaInputAcceptedCommandList : public ReadAttribute { public: ReadMediaInputAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadMediaInputAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaInput::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaInput AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaInputAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeMediaInputAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeMediaInputAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaInput::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadMediaInputEventList : public ReadAttribute { public: ReadMediaInputEventList() : ReadAttribute("event-list") { } ~ReadMediaInputEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaInput::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaInput EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaInputEventList : public SubscribeAttribute { public: SubscribeAttributeMediaInputEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeMediaInputEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaInput::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadMediaInputAttributeList : public ReadAttribute { public: ReadMediaInputAttributeList() : ReadAttribute("attribute-list") { } ~ReadMediaInputAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaInput::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaInput AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaInputAttributeList : public SubscribeAttribute { public: SubscribeAttributeMediaInputAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeMediaInputAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaInput::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadMediaInputFeatureMap : public ReadAttribute { public: ReadMediaInputFeatureMap() : ReadAttribute("feature-map") { } ~ReadMediaInputFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaInput::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaInput FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaInputFeatureMap : public SubscribeAttribute { public: SubscribeAttributeMediaInputFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeMediaInputFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaInput::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadMediaInputClusterRevision : public ReadAttribute { public: ReadMediaInputClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadMediaInputClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::MediaInput::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("MediaInput ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeMediaInputClusterRevision : public SubscribeAttribute { public: SubscribeAttributeMediaInputClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeMediaInputClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::MediaInput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::MediaInput::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster LowPower | 0x0508 | |------------------------------------------------------------------------------| | Commands: | | | * Sleep | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command Sleep */ class LowPowerSleep : public ClusterCommand { public: LowPowerSleep() : ClusterCommand("sleep") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LowPower::Id; constexpr chip::CommandId commandId = chip::app::Clusters::LowPower::Commands::Sleep::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRLowPowerClusterSleepParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster sleepWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Attribute GeneratedCommandList */ class ReadLowPowerGeneratedCommandList : public ReadAttribute { public: ReadLowPowerGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadLowPowerGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LowPower::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LowPower::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LowPower.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LowPower GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLowPowerGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeLowPowerGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeLowPowerGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LowPower::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LowPower::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LowPower.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadLowPowerAcceptedCommandList : public ReadAttribute { public: ReadLowPowerAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadLowPowerAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LowPower::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LowPower::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LowPower.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LowPower AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLowPowerAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeLowPowerAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeLowPowerAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LowPower::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LowPower::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LowPower.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadLowPowerEventList : public ReadAttribute { public: ReadLowPowerEventList() : ReadAttribute("event-list") { } ~ReadLowPowerEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LowPower::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LowPower::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LowPower.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LowPower EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLowPowerEventList : public SubscribeAttribute { public: SubscribeAttributeLowPowerEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeLowPowerEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LowPower::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LowPower::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LowPower.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadLowPowerAttributeList : public ReadAttribute { public: ReadLowPowerAttributeList() : ReadAttribute("attribute-list") { } ~ReadLowPowerAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LowPower::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LowPower::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LowPower.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LowPower AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLowPowerAttributeList : public SubscribeAttribute { public: SubscribeAttributeLowPowerAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeLowPowerAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LowPower::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LowPower::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LowPower.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadLowPowerFeatureMap : public ReadAttribute { public: ReadLowPowerFeatureMap() : ReadAttribute("feature-map") { } ~ReadLowPowerFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LowPower::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LowPower::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LowPower.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LowPower FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLowPowerFeatureMap : public SubscribeAttribute { public: SubscribeAttributeLowPowerFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeLowPowerFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LowPower::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LowPower::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LowPower.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadLowPowerClusterRevision : public ReadAttribute { public: ReadLowPowerClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadLowPowerClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LowPower::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::LowPower::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LowPower.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("LowPower ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeLowPowerClusterRevision : public SubscribeAttribute { public: SubscribeAttributeLowPowerClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeLowPowerClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::LowPower::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::LowPower::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LowPower.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster KeypadInput | 0x0509 | |------------------------------------------------------------------------------| | Commands: | | | * SendKey | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command SendKey */ class KeypadInputSendKey : public ClusterCommand { public: KeypadInputSendKey() : ClusterCommand("send-key") { AddArgument("KeyCode", 0, UINT8_MAX, &mRequest.keyCode); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::KeypadInput::Id; constexpr chip::CommandId commandId = chip::app::Clusters::KeypadInput::Commands::SendKey::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRKeypadInputClusterSendKeyParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.keyCode = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.keyCode)]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster sendKeyWithParams:params completion: ^(MTRKeypadInputClusterSendKeyResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::KeypadInput::Commands::SendKeyResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::KeypadInput::Commands::SendKey::Type mRequest; }; /* * Attribute GeneratedCommandList */ class ReadKeypadInputGeneratedCommandList : public ReadAttribute { public: ReadKeypadInputGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadKeypadInputGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::KeypadInput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::KeypadInput::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"KeypadInput.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("KeypadInput GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeKeypadInputGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeKeypadInputGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeKeypadInputGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::KeypadInput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::KeypadInput::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"KeypadInput.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadKeypadInputAcceptedCommandList : public ReadAttribute { public: ReadKeypadInputAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadKeypadInputAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::KeypadInput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::KeypadInput::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"KeypadInput.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("KeypadInput AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeKeypadInputAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeKeypadInputAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeKeypadInputAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::KeypadInput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::KeypadInput::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"KeypadInput.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadKeypadInputEventList : public ReadAttribute { public: ReadKeypadInputEventList() : ReadAttribute("event-list") { } ~ReadKeypadInputEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::KeypadInput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::KeypadInput::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"KeypadInput.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("KeypadInput EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeKeypadInputEventList : public SubscribeAttribute { public: SubscribeAttributeKeypadInputEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeKeypadInputEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::KeypadInput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::KeypadInput::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"KeypadInput.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadKeypadInputAttributeList : public ReadAttribute { public: ReadKeypadInputAttributeList() : ReadAttribute("attribute-list") { } ~ReadKeypadInputAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::KeypadInput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::KeypadInput::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"KeypadInput.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("KeypadInput AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeKeypadInputAttributeList : public SubscribeAttribute { public: SubscribeAttributeKeypadInputAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeKeypadInputAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::KeypadInput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::KeypadInput::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"KeypadInput.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadKeypadInputFeatureMap : public ReadAttribute { public: ReadKeypadInputFeatureMap() : ReadAttribute("feature-map") { } ~ReadKeypadInputFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::KeypadInput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::KeypadInput::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"KeypadInput.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("KeypadInput FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeKeypadInputFeatureMap : public SubscribeAttribute { public: SubscribeAttributeKeypadInputFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeKeypadInputFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::KeypadInput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::KeypadInput::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"KeypadInput.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadKeypadInputClusterRevision : public ReadAttribute { public: ReadKeypadInputClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadKeypadInputClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::KeypadInput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::KeypadInput::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"KeypadInput.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("KeypadInput ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeKeypadInputClusterRevision : public SubscribeAttribute { public: SubscribeAttributeKeypadInputClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeKeypadInputClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::KeypadInput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::KeypadInput::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"KeypadInput.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster ContentLauncher | 0x050A | |------------------------------------------------------------------------------| | Commands: | | | * LaunchContent | 0x00 | | * LaunchURL | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | | * AcceptHeader | 0x0000 | | * SupportedStreamingProtocols | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command LaunchContent */ class ContentLauncherLaunchContent : public ClusterCommand { public: ContentLauncherLaunchContent() : ClusterCommand("launch-content") , mComplex_Search(&mRequest.search) , mComplex_PlaybackPreferences(&mRequest.playbackPreferences) { AddArgument("Search", &mComplex_Search); AddArgument("AutoPlay", 0, 1, &mRequest.autoPlay); AddArgument("Data", &mRequest.data); #if MTR_ENABLE_PROVISIONAL AddArgument("PlaybackPreferences", &mComplex_PlaybackPreferences); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("UseCurrentContext", 0, 1, &mRequest.useCurrentContext); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRContentLauncherClusterLaunchContentParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.search = [MTRContentLauncherClusterContentSearchStruct new]; { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.search.parameterList) { MTRContentLauncherClusterParameterStruct * newElement_1; newElement_1 = [MTRContentLauncherClusterParameterStruct new]; newElement_1.type = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1.type)]; newElement_1.value = [[NSString alloc] initWithBytes:entry_1.value.data() length:entry_1.value.size() encoding:NSUTF8StringEncoding]; if (entry_1.externalIDList.HasValue()) { { // Scope for our temporary variables auto * array_4 = [NSMutableArray new]; for (auto & entry_4 : entry_1.externalIDList.Value()) { MTRContentLauncherClusterAdditionalInfoStruct * newElement_4; newElement_4 = [MTRContentLauncherClusterAdditionalInfoStruct new]; newElement_4.name = [[NSString alloc] initWithBytes:entry_4.name.data() length:entry_4.name.size() encoding:NSUTF8StringEncoding]; newElement_4.value = [[NSString alloc] initWithBytes:entry_4.value.data() length:entry_4.value.size() encoding:NSUTF8StringEncoding]; [array_4 addObject:newElement_4]; } newElement_1.externalIDList = array_4; } } else { newElement_1.externalIDList = nil; } [array_1 addObject:newElement_1]; } params.search.parameterList = array_1; } params.autoPlay = [NSNumber numberWithBool:mRequest.autoPlay]; if (mRequest.data.HasValue()) { params.data = [[NSString alloc] initWithBytes:mRequest.data.Value().data() length:mRequest.data.Value().size() encoding:NSUTF8StringEncoding]; } else { params.data = nil; } #if MTR_ENABLE_PROVISIONAL if (mRequest.playbackPreferences.HasValue()) { params.playbackPreferences = [MTRContentLauncherClusterPlaybackPreferencesStruct new]; params.playbackPreferences.playbackPosition = [NSNumber numberWithUnsignedLongLong:mRequest.playbackPreferences.Value().playbackPosition]; params.playbackPreferences.textTrack = [MTRContentLauncherClusterTrackPreferenceStruct new]; params.playbackPreferences.textTrack.languageCode = [[NSString alloc] initWithBytes:mRequest.playbackPreferences.Value().textTrack.languageCode.data() length:mRequest.playbackPreferences.Value().textTrack.languageCode.size() encoding:NSUTF8StringEncoding]; if (mRequest.playbackPreferences.Value().textTrack.characteristics.HasValue()) { { // Scope for our temporary variables auto * array_4 = [NSMutableArray new]; for (auto & entry_4 : mRequest.playbackPreferences.Value().textTrack.characteristics.Value()) { NSNumber * newElement_4; newElement_4 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_4)]; [array_4 addObject:newElement_4]; } params.playbackPreferences.textTrack.characteristics = array_4; } } else { params.playbackPreferences.textTrack.characteristics = nil; } params.playbackPreferences.textTrack.audioOutputIndex = [NSNumber numberWithUnsignedChar:mRequest.playbackPreferences.Value().textTrack.audioOutputIndex]; if (mRequest.playbackPreferences.Value().audioTracks.HasValue()) { { // Scope for our temporary variables auto * array_3 = [NSMutableArray new]; for (auto & entry_3 : mRequest.playbackPreferences.Value().audioTracks.Value()) { MTRContentLauncherClusterTrackPreferenceStruct * newElement_3; newElement_3 = [MTRContentLauncherClusterTrackPreferenceStruct new]; newElement_3.languageCode = [[NSString alloc] initWithBytes:entry_3.languageCode.data() length:entry_3.languageCode.size() encoding:NSUTF8StringEncoding]; if (entry_3.characteristics.HasValue()) { { // Scope for our temporary variables auto * array_6 = [NSMutableArray new]; for (auto & entry_6 : entry_3.characteristics.Value()) { NSNumber * newElement_6; newElement_6 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_6)]; [array_6 addObject:newElement_6]; } newElement_3.characteristics = array_6; } } else { newElement_3.characteristics = nil; } newElement_3.audioOutputIndex = [NSNumber numberWithUnsignedChar:entry_3.audioOutputIndex]; [array_3 addObject:newElement_3]; } params.playbackPreferences.audioTracks = array_3; } } else { params.playbackPreferences.audioTracks = nil; } } else { params.playbackPreferences = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.useCurrentContext.HasValue()) { params.useCurrentContext = [NSNumber numberWithBool:mRequest.useCurrentContext.Value()]; } else { params.useCurrentContext = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster launchContentWithParams:params completion: ^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ContentLauncher::Commands::LaunchContent::Type mRequest; TypedComplexArgument mComplex_Search; TypedComplexArgument> mComplex_PlaybackPreferences; }; /* * Command LaunchURL */ class ContentLauncherLaunchURL : public ClusterCommand { public: ContentLauncherLaunchURL() : ClusterCommand("launch-url") , mComplex_BrandingInformation(&mRequest.brandingInformation) { AddArgument("ContentURL", &mRequest.contentURL); AddArgument("DisplayString", &mRequest.displayString); AddArgument("BrandingInformation", &mComplex_BrandingInformation); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRContentLauncherClusterLaunchURLParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.contentURL = [[NSString alloc] initWithBytes:mRequest.contentURL.data() length:mRequest.contentURL.size() encoding:NSUTF8StringEncoding]; if (mRequest.displayString.HasValue()) { params.displayString = [[NSString alloc] initWithBytes:mRequest.displayString.Value().data() length:mRequest.displayString.Value().size() encoding:NSUTF8StringEncoding]; } else { params.displayString = nil; } if (mRequest.brandingInformation.HasValue()) { params.brandingInformation = [MTRContentLauncherClusterBrandingInformationStruct new]; params.brandingInformation.providerName = [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().providerName.data() length:mRequest.brandingInformation.Value().providerName.size() encoding:NSUTF8StringEncoding]; if (mRequest.brandingInformation.Value().background.HasValue()) { params.brandingInformation.background = [MTRContentLauncherClusterStyleInformationStruct new]; if (mRequest.brandingInformation.Value().background.Value().imageURL.HasValue()) { params.brandingInformation.background.imageURL = [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().background.Value().imageURL.Value().data() length:mRequest.brandingInformation.Value().background.Value().imageURL.Value().size() encoding:NSUTF8StringEncoding]; } else { params.brandingInformation.background.imageURL = nil; } if (mRequest.brandingInformation.Value().background.Value().color.HasValue()) { params.brandingInformation.background.color = [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().background.Value().color.Value().data() length:mRequest.brandingInformation.Value().background.Value().color.Value().size() encoding:NSUTF8StringEncoding]; } else { params.brandingInformation.background.color = nil; } if (mRequest.brandingInformation.Value().background.Value().size.HasValue()) { params.brandingInformation.background.size = [MTRContentLauncherClusterDimensionStruct new]; params.brandingInformation.background.size.width = [NSNumber numberWithDouble:mRequest.brandingInformation.Value().background.Value().size.Value().width]; params.brandingInformation.background.size.height = [NSNumber numberWithDouble:mRequest.brandingInformation.Value().background.Value().size.Value().height]; params.brandingInformation.background.size.metric = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.brandingInformation.Value().background.Value().size.Value().metric)]; } else { params.brandingInformation.background.size = nil; } } else { params.brandingInformation.background = nil; } if (mRequest.brandingInformation.Value().logo.HasValue()) { params.brandingInformation.logo = [MTRContentLauncherClusterStyleInformationStruct new]; if (mRequest.brandingInformation.Value().logo.Value().imageURL.HasValue()) { params.brandingInformation.logo.imageURL = [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().logo.Value().imageURL.Value().data() length:mRequest.brandingInformation.Value().logo.Value().imageURL.Value().size() encoding:NSUTF8StringEncoding]; } else { params.brandingInformation.logo.imageURL = nil; } if (mRequest.brandingInformation.Value().logo.Value().color.HasValue()) { params.brandingInformation.logo.color = [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().logo.Value().color.Value().data() length:mRequest.brandingInformation.Value().logo.Value().color.Value().size() encoding:NSUTF8StringEncoding]; } else { params.brandingInformation.logo.color = nil; } if (mRequest.brandingInformation.Value().logo.Value().size.HasValue()) { params.brandingInformation.logo.size = [MTRContentLauncherClusterDimensionStruct new]; params.brandingInformation.logo.size.width = [NSNumber numberWithDouble:mRequest.brandingInformation.Value().logo.Value().size.Value().width]; params.brandingInformation.logo.size.height = [NSNumber numberWithDouble:mRequest.brandingInformation.Value().logo.Value().size.Value().height]; params.brandingInformation.logo.size.metric = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.brandingInformation.Value().logo.Value().size.Value().metric)]; } else { params.brandingInformation.logo.size = nil; } } else { params.brandingInformation.logo = nil; } if (mRequest.brandingInformation.Value().progressBar.HasValue()) { params.brandingInformation.progressBar = [MTRContentLauncherClusterStyleInformationStruct new]; if (mRequest.brandingInformation.Value().progressBar.Value().imageURL.HasValue()) { params.brandingInformation.progressBar.imageURL = [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().progressBar.Value().imageURL.Value().data() length:mRequest.brandingInformation.Value().progressBar.Value().imageURL.Value().size() encoding:NSUTF8StringEncoding]; } else { params.brandingInformation.progressBar.imageURL = nil; } if (mRequest.brandingInformation.Value().progressBar.Value().color.HasValue()) { params.brandingInformation.progressBar.color = [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().progressBar.Value().color.Value().data() length:mRequest.brandingInformation.Value().progressBar.Value().color.Value().size() encoding:NSUTF8StringEncoding]; } else { params.brandingInformation.progressBar.color = nil; } if (mRequest.brandingInformation.Value().progressBar.Value().size.HasValue()) { params.brandingInformation.progressBar.size = [MTRContentLauncherClusterDimensionStruct new]; params.brandingInformation.progressBar.size.width = [NSNumber numberWithDouble:mRequest.brandingInformation.Value().progressBar.Value().size.Value().width]; params.brandingInformation.progressBar.size.height = [NSNumber numberWithDouble:mRequest.brandingInformation.Value().progressBar.Value().size.Value().height]; params.brandingInformation.progressBar.size.metric = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.brandingInformation.Value().progressBar.Value().size.Value().metric)]; } else { params.brandingInformation.progressBar.size = nil; } } else { params.brandingInformation.progressBar = nil; } if (mRequest.brandingInformation.Value().splash.HasValue()) { params.brandingInformation.splash = [MTRContentLauncherClusterStyleInformationStruct new]; if (mRequest.brandingInformation.Value().splash.Value().imageURL.HasValue()) { params.brandingInformation.splash.imageURL = [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().splash.Value().imageURL.Value().data() length:mRequest.brandingInformation.Value().splash.Value().imageURL.Value().size() encoding:NSUTF8StringEncoding]; } else { params.brandingInformation.splash.imageURL = nil; } if (mRequest.brandingInformation.Value().splash.Value().color.HasValue()) { params.brandingInformation.splash.color = [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().splash.Value().color.Value().data() length:mRequest.brandingInformation.Value().splash.Value().color.Value().size() encoding:NSUTF8StringEncoding]; } else { params.brandingInformation.splash.color = nil; } if (mRequest.brandingInformation.Value().splash.Value().size.HasValue()) { params.brandingInformation.splash.size = [MTRContentLauncherClusterDimensionStruct new]; params.brandingInformation.splash.size.width = [NSNumber numberWithDouble:mRequest.brandingInformation.Value().splash.Value().size.Value().width]; params.brandingInformation.splash.size.height = [NSNumber numberWithDouble:mRequest.brandingInformation.Value().splash.Value().size.Value().height]; params.brandingInformation.splash.size.metric = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.brandingInformation.Value().splash.Value().size.Value().metric)]; } else { params.brandingInformation.splash.size = nil; } } else { params.brandingInformation.splash = nil; } if (mRequest.brandingInformation.Value().waterMark.HasValue()) { params.brandingInformation.waterMark = [MTRContentLauncherClusterStyleInformationStruct new]; if (mRequest.brandingInformation.Value().waterMark.Value().imageURL.HasValue()) { params.brandingInformation.waterMark.imageURL = [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().waterMark.Value().imageURL.Value().data() length:mRequest.brandingInformation.Value().waterMark.Value().imageURL.Value().size() encoding:NSUTF8StringEncoding]; } else { params.brandingInformation.waterMark.imageURL = nil; } if (mRequest.brandingInformation.Value().waterMark.Value().color.HasValue()) { params.brandingInformation.waterMark.color = [[NSString alloc] initWithBytes:mRequest.brandingInformation.Value().waterMark.Value().color.Value().data() length:mRequest.brandingInformation.Value().waterMark.Value().color.Value().size() encoding:NSUTF8StringEncoding]; } else { params.brandingInformation.waterMark.color = nil; } if (mRequest.brandingInformation.Value().waterMark.Value().size.HasValue()) { params.brandingInformation.waterMark.size = [MTRContentLauncherClusterDimensionStruct new]; params.brandingInformation.waterMark.size.width = [NSNumber numberWithDouble:mRequest.brandingInformation.Value().waterMark.Value().size.Value().width]; params.brandingInformation.waterMark.size.height = [NSNumber numberWithDouble:mRequest.brandingInformation.Value().waterMark.Value().size.Value().height]; params.brandingInformation.waterMark.size.metric = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.brandingInformation.Value().waterMark.Value().size.Value().metric)]; } else { params.brandingInformation.waterMark.size = nil; } } else { params.brandingInformation.waterMark = nil; } } else { params.brandingInformation = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster launchURLWithParams:params completion: ^(MTRContentLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ContentLauncher::Commands::LauncherResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ContentLauncher::Commands::LaunchURL::Type mRequest; TypedComplexArgument> mComplex_BrandingInformation; }; /* * Attribute AcceptHeader */ class ReadContentLauncherAcceptHeader : public ReadAttribute { public: ReadContentLauncherAcceptHeader() : ReadAttribute("accept-header") { } ~ReadContentLauncherAcceptHeader() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentLauncher::Attributes::AcceptHeader::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptHeaderWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.AcceptHeader response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentLauncher AcceptHeader read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentLauncherAcceptHeader : public SubscribeAttribute { public: SubscribeAttributeContentLauncherAcceptHeader() : SubscribeAttribute("accept-header") { } ~SubscribeAttributeContentLauncherAcceptHeader() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentLauncher::Attributes::AcceptHeader::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptHeaderWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.AcceptHeader response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute SupportedStreamingProtocols */ class ReadContentLauncherSupportedStreamingProtocols : public ReadAttribute { public: ReadContentLauncherSupportedStreamingProtocols() : ReadAttribute("supported-streaming-protocols") { } ~ReadContentLauncherSupportedStreamingProtocols() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedStreamingProtocolsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.SupportedStreamingProtocols response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentLauncher SupportedStreamingProtocols read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentLauncherSupportedStreamingProtocols : public SubscribeAttribute { public: SubscribeAttributeContentLauncherSupportedStreamingProtocols() : SubscribeAttribute("supported-streaming-protocols") { } ~SubscribeAttributeContentLauncherSupportedStreamingProtocols() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedStreamingProtocolsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.SupportedStreamingProtocols response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadContentLauncherGeneratedCommandList : public ReadAttribute { public: ReadContentLauncherGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadContentLauncherGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentLauncher::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentLauncher GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentLauncherGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeContentLauncherGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeContentLauncherGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentLauncher::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadContentLauncherAcceptedCommandList : public ReadAttribute { public: ReadContentLauncherAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadContentLauncherAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentLauncher::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentLauncher AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentLauncherAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeContentLauncherAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeContentLauncherAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentLauncher::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadContentLauncherEventList : public ReadAttribute { public: ReadContentLauncherEventList() : ReadAttribute("event-list") { } ~ReadContentLauncherEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentLauncher::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentLauncher EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentLauncherEventList : public SubscribeAttribute { public: SubscribeAttributeContentLauncherEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeContentLauncherEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentLauncher::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadContentLauncherAttributeList : public ReadAttribute { public: ReadContentLauncherAttributeList() : ReadAttribute("attribute-list") { } ~ReadContentLauncherAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentLauncher::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentLauncher AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentLauncherAttributeList : public SubscribeAttribute { public: SubscribeAttributeContentLauncherAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeContentLauncherAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentLauncher::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadContentLauncherFeatureMap : public ReadAttribute { public: ReadContentLauncherFeatureMap() : ReadAttribute("feature-map") { } ~ReadContentLauncherFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentLauncher::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentLauncher FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentLauncherFeatureMap : public SubscribeAttribute { public: SubscribeAttributeContentLauncherFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeContentLauncherFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentLauncher::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadContentLauncherClusterRevision : public ReadAttribute { public: ReadContentLauncherClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadContentLauncherClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentLauncher::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentLauncher ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentLauncherClusterRevision : public SubscribeAttribute { public: SubscribeAttributeContentLauncherClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeContentLauncherClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentLauncher::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentLauncher::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster AudioOutput | 0x050B | |------------------------------------------------------------------------------| | Commands: | | | * SelectOutput | 0x00 | | * RenameOutput | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | | * OutputList | 0x0000 | | * CurrentOutput | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command SelectOutput */ class AudioOutputSelectOutput : public ClusterCommand { public: AudioOutputSelectOutput() : ClusterCommand("select-output") { AddArgument("Index", 0, UINT8_MAX, &mRequest.index); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::CommandId commandId = chip::app::Clusters::AudioOutput::Commands::SelectOutput::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRAudioOutputClusterSelectOutputParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.index = [NSNumber numberWithUnsignedChar:mRequest.index]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster selectOutputWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::AudioOutput::Commands::SelectOutput::Type mRequest; }; /* * Command RenameOutput */ class AudioOutputRenameOutput : public ClusterCommand { public: AudioOutputRenameOutput() : ClusterCommand("rename-output") { AddArgument("Index", 0, UINT8_MAX, &mRequest.index); AddArgument("Name", &mRequest.name); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::CommandId commandId = chip::app::Clusters::AudioOutput::Commands::RenameOutput::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRAudioOutputClusterRenameOutputParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.index = [NSNumber numberWithUnsignedChar:mRequest.index]; params.name = [[NSString alloc] initWithBytes:mRequest.name.data() length:mRequest.name.size() encoding:NSUTF8StringEncoding]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster renameOutputWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::AudioOutput::Commands::RenameOutput::Type mRequest; }; /* * Attribute OutputList */ class ReadAudioOutputOutputList : public ReadAttribute { public: ReadAudioOutputOutputList() : ReadAttribute("output-list") { } ~ReadAudioOutputOutputList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AudioOutput::Attributes::OutputList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOutputListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.OutputList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AudioOutput OutputList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAudioOutputOutputList : public SubscribeAttribute { public: SubscribeAttributeAudioOutputOutputList() : SubscribeAttribute("output-list") { } ~SubscribeAttributeAudioOutputOutputList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AudioOutput::Attributes::OutputList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOutputListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.OutputList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentOutput */ class ReadAudioOutputCurrentOutput : public ReadAttribute { public: ReadAudioOutputCurrentOutput() : ReadAttribute("current-output") { } ~ReadAudioOutputCurrentOutput() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AudioOutput::Attributes::CurrentOutput::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentOutputWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.CurrentOutput response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AudioOutput CurrentOutput read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAudioOutputCurrentOutput : public SubscribeAttribute { public: SubscribeAttributeAudioOutputCurrentOutput() : SubscribeAttribute("current-output") { } ~SubscribeAttributeAudioOutputCurrentOutput() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AudioOutput::Attributes::CurrentOutput::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentOutputWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.CurrentOutput response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadAudioOutputGeneratedCommandList : public ReadAttribute { public: ReadAudioOutputGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadAudioOutputGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AudioOutput::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AudioOutput GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAudioOutputGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeAudioOutputGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeAudioOutputGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AudioOutput::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadAudioOutputAcceptedCommandList : public ReadAttribute { public: ReadAudioOutputAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadAudioOutputAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AudioOutput::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AudioOutput AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAudioOutputAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeAudioOutputAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeAudioOutputAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AudioOutput::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadAudioOutputEventList : public ReadAttribute { public: ReadAudioOutputEventList() : ReadAttribute("event-list") { } ~ReadAudioOutputEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AudioOutput::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AudioOutput EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAudioOutputEventList : public SubscribeAttribute { public: SubscribeAttributeAudioOutputEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeAudioOutputEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AudioOutput::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadAudioOutputAttributeList : public ReadAttribute { public: ReadAudioOutputAttributeList() : ReadAttribute("attribute-list") { } ~ReadAudioOutputAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AudioOutput::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AudioOutput AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAudioOutputAttributeList : public SubscribeAttribute { public: SubscribeAttributeAudioOutputAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeAudioOutputAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AudioOutput::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadAudioOutputFeatureMap : public ReadAttribute { public: ReadAudioOutputFeatureMap() : ReadAttribute("feature-map") { } ~ReadAudioOutputFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AudioOutput::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AudioOutput FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAudioOutputFeatureMap : public SubscribeAttribute { public: SubscribeAttributeAudioOutputFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeAudioOutputFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AudioOutput::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadAudioOutputClusterRevision : public ReadAttribute { public: ReadAudioOutputClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadAudioOutputClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AudioOutput::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AudioOutput ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAudioOutputClusterRevision : public SubscribeAttribute { public: SubscribeAttributeAudioOutputClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeAudioOutputClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AudioOutput::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AudioOutput::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster ApplicationLauncher | 0x050C | |------------------------------------------------------------------------------| | Commands: | | | * LaunchApp | 0x00 | | * StopApp | 0x01 | | * HideApp | 0x02 | |------------------------------------------------------------------------------| | Attributes: | | | * CatalogList | 0x0000 | | * CurrentApp | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Command LaunchApp */ class ApplicationLauncherLaunchApp : public ClusterCommand { public: ApplicationLauncherLaunchApp() : ClusterCommand("launch-app") , mComplex_Application(&mRequest.application) { AddArgument("Application", &mComplex_Application); AddArgument("Data", &mRequest.data); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ApplicationLauncher::Commands::LaunchApp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRApplicationLauncherClusterLaunchAppParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; if (mRequest.application.HasValue()) { params.application = [MTRApplicationLauncherClusterApplicationStruct new]; params.application.catalogVendorID = [NSNumber numberWithUnsignedShort:mRequest.application.Value().catalogVendorID]; params.application.applicationID = [[NSString alloc] initWithBytes:mRequest.application.Value().applicationID.data() length:mRequest.application.Value().applicationID.size() encoding:NSUTF8StringEncoding]; } else { params.application = nil; } if (mRequest.data.HasValue()) { params.data = [NSData dataWithBytes:mRequest.data.Value().data() length:mRequest.data.Value().size()]; } else { params.data = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster launchAppWithParams:params completion: ^(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ApplicationLauncher::Commands::LaunchApp::Type mRequest; TypedComplexArgument> mComplex_Application; }; /* * Command StopApp */ class ApplicationLauncherStopApp : public ClusterCommand { public: ApplicationLauncherStopApp() : ClusterCommand("stop-app") , mComplex_Application(&mRequest.application) { AddArgument("Application", &mComplex_Application); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ApplicationLauncher::Commands::StopApp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRApplicationLauncherClusterStopAppParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; if (mRequest.application.HasValue()) { params.application = [MTRApplicationLauncherClusterApplicationStruct new]; params.application.catalogVendorID = [NSNumber numberWithUnsignedShort:mRequest.application.Value().catalogVendorID]; params.application.applicationID = [[NSString alloc] initWithBytes:mRequest.application.Value().applicationID.data() length:mRequest.application.Value().applicationID.size() encoding:NSUTF8StringEncoding]; } else { params.application = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stopAppWithParams:params completion: ^(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ApplicationLauncher::Commands::StopApp::Type mRequest; TypedComplexArgument> mComplex_Application; }; /* * Command HideApp */ class ApplicationLauncherHideApp : public ClusterCommand { public: ApplicationLauncherHideApp() : ClusterCommand("hide-app") , mComplex_Application(&mRequest.application) { AddArgument("Application", &mComplex_Application); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ApplicationLauncher::Commands::HideApp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRApplicationLauncherClusterHideAppParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; if (mRequest.application.HasValue()) { params.application = [MTRApplicationLauncherClusterApplicationStruct new]; params.application.catalogVendorID = [NSNumber numberWithUnsignedShort:mRequest.application.Value().catalogVendorID]; params.application.applicationID = [[NSString alloc] initWithBytes:mRequest.application.Value().applicationID.data() length:mRequest.application.Value().applicationID.size() encoding:NSUTF8StringEncoding]; } else { params.application = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster hideAppWithParams:params completion: ^(MTRApplicationLauncherClusterLauncherResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ApplicationLauncher::Commands::LauncherResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ApplicationLauncher::Commands::HideApp::Type mRequest; TypedComplexArgument> mComplex_Application; }; /* * Attribute CatalogList */ class ReadApplicationLauncherCatalogList : public ReadAttribute { public: ReadApplicationLauncherCatalogList() : ReadAttribute("catalog-list") { } ~ReadApplicationLauncherCatalogList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationLauncher::Attributes::CatalogList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCatalogListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.CatalogList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationLauncher CatalogList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationLauncherCatalogList : public SubscribeAttribute { public: SubscribeAttributeApplicationLauncherCatalogList() : SubscribeAttribute("catalog-list") { } ~SubscribeAttributeApplicationLauncherCatalogList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationLauncher::Attributes::CatalogList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCatalogListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.CatalogList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CurrentApp */ class ReadApplicationLauncherCurrentApp : public ReadAttribute { public: ReadApplicationLauncherCurrentApp() : ReadAttribute("current-app") { } ~ReadApplicationLauncherCurrentApp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationLauncher::Attributes::CurrentApp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentAppWithCompletion:^(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.CurrentApp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationLauncher CurrentApp read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationLauncherCurrentApp : public SubscribeAttribute { public: SubscribeAttributeApplicationLauncherCurrentApp() : SubscribeAttribute("current-app") { } ~SubscribeAttributeApplicationLauncherCurrentApp() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationLauncher::Attributes::CurrentApp::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentAppWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.CurrentApp response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadApplicationLauncherGeneratedCommandList : public ReadAttribute { public: ReadApplicationLauncherGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadApplicationLauncherGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationLauncher::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationLauncher GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationLauncherGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeApplicationLauncherGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeApplicationLauncherGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationLauncher::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadApplicationLauncherAcceptedCommandList : public ReadAttribute { public: ReadApplicationLauncherAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadApplicationLauncherAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationLauncher::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationLauncher AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationLauncherAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeApplicationLauncherAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeApplicationLauncherAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationLauncher::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadApplicationLauncherEventList : public ReadAttribute { public: ReadApplicationLauncherEventList() : ReadAttribute("event-list") { } ~ReadApplicationLauncherEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationLauncher::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationLauncher EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationLauncherEventList : public SubscribeAttribute { public: SubscribeAttributeApplicationLauncherEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeApplicationLauncherEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationLauncher::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadApplicationLauncherAttributeList : public ReadAttribute { public: ReadApplicationLauncherAttributeList() : ReadAttribute("attribute-list") { } ~ReadApplicationLauncherAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationLauncher::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationLauncher AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationLauncherAttributeList : public SubscribeAttribute { public: SubscribeAttributeApplicationLauncherAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeApplicationLauncherAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationLauncher::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadApplicationLauncherFeatureMap : public ReadAttribute { public: ReadApplicationLauncherFeatureMap() : ReadAttribute("feature-map") { } ~ReadApplicationLauncherFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationLauncher::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationLauncher FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationLauncherFeatureMap : public SubscribeAttribute { public: SubscribeAttributeApplicationLauncherFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeApplicationLauncherFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationLauncher::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadApplicationLauncherClusterRevision : public ReadAttribute { public: ReadApplicationLauncherClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadApplicationLauncherClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationLauncher::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationLauncher ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationLauncherClusterRevision : public SubscribeAttribute { public: SubscribeAttributeApplicationLauncherClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeApplicationLauncherClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationLauncher::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationLauncher::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster ApplicationBasic | 0x050D | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * VendorName | 0x0000 | | * VendorID | 0x0001 | | * ApplicationName | 0x0002 | | * ProductID | 0x0003 | | * Application | 0x0004 | | * Status | 0x0005 | | * ApplicationVersion | 0x0006 | | * AllowedVendorList | 0x0007 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ /* * Attribute VendorName */ class ReadApplicationBasicVendorName : public ReadAttribute { public: ReadApplicationBasicVendorName() : ReadAttribute("vendor-name") { } ~ReadApplicationBasicVendorName() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::VendorName::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeVendorNameWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.VendorName response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationBasic VendorName read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationBasicVendorName : public SubscribeAttribute { public: SubscribeAttributeApplicationBasicVendorName() : SubscribeAttribute("vendor-name") { } ~SubscribeAttributeApplicationBasicVendorName() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::VendorName::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeVendorNameWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.VendorName response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute VendorID */ class ReadApplicationBasicVendorID : public ReadAttribute { public: ReadApplicationBasicVendorID() : ReadAttribute("vendor-id") { } ~ReadApplicationBasicVendorID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::VendorID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeVendorIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.VendorID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationBasic VendorID read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationBasicVendorID : public SubscribeAttribute { public: SubscribeAttributeApplicationBasicVendorID() : SubscribeAttribute("vendor-id") { } ~SubscribeAttributeApplicationBasicVendorID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::VendorID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeVendorIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.VendorID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ApplicationName */ class ReadApplicationBasicApplicationName : public ReadAttribute { public: ReadApplicationBasicApplicationName() : ReadAttribute("application-name") { } ~ReadApplicationBasicApplicationName() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::ApplicationName::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeApplicationNameWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.ApplicationName response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationBasic ApplicationName read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationBasicApplicationName : public SubscribeAttribute { public: SubscribeAttributeApplicationBasicApplicationName() : SubscribeAttribute("application-name") { } ~SubscribeAttributeApplicationBasicApplicationName() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::ApplicationName::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeApplicationNameWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.ApplicationName response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ProductID */ class ReadApplicationBasicProductID : public ReadAttribute { public: ReadApplicationBasicProductID() : ReadAttribute("product-id") { } ~ReadApplicationBasicProductID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::ProductID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeProductIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.ProductID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationBasic ProductID read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationBasicProductID : public SubscribeAttribute { public: SubscribeAttributeApplicationBasicProductID() : SubscribeAttribute("product-id") { } ~SubscribeAttributeApplicationBasicProductID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::ProductID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeProductIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.ProductID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Application */ class ReadApplicationBasicApplication : public ReadAttribute { public: ReadApplicationBasicApplication() : ReadAttribute("application") { } ~ReadApplicationBasicApplication() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::Application::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeApplicationWithCompletion:^(MTRApplicationBasicClusterApplicationStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.Application response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationBasic Application read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationBasicApplication : public SubscribeAttribute { public: SubscribeAttributeApplicationBasicApplication() : SubscribeAttribute("application") { } ~SubscribeAttributeApplicationBasicApplication() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::Application::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeApplicationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRApplicationBasicClusterApplicationStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.Application response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Status */ class ReadApplicationBasicStatus : public ReadAttribute { public: ReadApplicationBasicStatus() : ReadAttribute("status") { } ~ReadApplicationBasicStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::Status::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.Status response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationBasic Status read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationBasicStatus : public SubscribeAttribute { public: SubscribeAttributeApplicationBasicStatus() : SubscribeAttribute("status") { } ~SubscribeAttributeApplicationBasicStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::Status::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStatusWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.Status response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ApplicationVersion */ class ReadApplicationBasicApplicationVersion : public ReadAttribute { public: ReadApplicationBasicApplicationVersion() : ReadAttribute("application-version") { } ~ReadApplicationBasicApplicationVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::ApplicationVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeApplicationVersionWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.ApplicationVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationBasic ApplicationVersion read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationBasicApplicationVersion : public SubscribeAttribute { public: SubscribeAttributeApplicationBasicApplicationVersion() : SubscribeAttribute("application-version") { } ~SubscribeAttributeApplicationBasicApplicationVersion() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::ApplicationVersion::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeApplicationVersionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.ApplicationVersion response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AllowedVendorList */ class ReadApplicationBasicAllowedVendorList : public ReadAttribute { public: ReadApplicationBasicAllowedVendorList() : ReadAttribute("allowed-vendor-list") { } ~ReadApplicationBasicAllowedVendorList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::AllowedVendorList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAllowedVendorListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.AllowedVendorList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationBasic AllowedVendorList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationBasicAllowedVendorList : public SubscribeAttribute { public: SubscribeAttributeApplicationBasicAllowedVendorList() : SubscribeAttribute("allowed-vendor-list") { } ~SubscribeAttributeApplicationBasicAllowedVendorList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::AllowedVendorList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAllowedVendorListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.AllowedVendorList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneratedCommandList */ class ReadApplicationBasicGeneratedCommandList : public ReadAttribute { public: ReadApplicationBasicGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadApplicationBasicGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationBasic GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationBasicGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeApplicationBasicGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeApplicationBasicGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadApplicationBasicAcceptedCommandList : public ReadAttribute { public: ReadApplicationBasicAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadApplicationBasicAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationBasic AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationBasicAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeApplicationBasicAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeApplicationBasicAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadApplicationBasicEventList : public ReadAttribute { public: ReadApplicationBasicEventList() : ReadAttribute("event-list") { } ~ReadApplicationBasicEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationBasic EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationBasicEventList : public SubscribeAttribute { public: SubscribeAttributeApplicationBasicEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeApplicationBasicEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadApplicationBasicAttributeList : public ReadAttribute { public: ReadApplicationBasicAttributeList() : ReadAttribute("attribute-list") { } ~ReadApplicationBasicAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationBasic AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationBasicAttributeList : public SubscribeAttribute { public: SubscribeAttributeApplicationBasicAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeApplicationBasicAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadApplicationBasicFeatureMap : public ReadAttribute { public: ReadApplicationBasicFeatureMap() : ReadAttribute("feature-map") { } ~ReadApplicationBasicFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationBasic FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationBasicFeatureMap : public SubscribeAttribute { public: SubscribeAttributeApplicationBasicFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeApplicationBasicFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadApplicationBasicClusterRevision : public ReadAttribute { public: ReadApplicationBasicClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadApplicationBasicClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ApplicationBasic ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeApplicationBasicClusterRevision : public SubscribeAttribute { public: SubscribeAttributeApplicationBasicClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeApplicationBasicClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ApplicationBasic::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ApplicationBasic::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterApplicationBasic alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /*----------------------------------------------------------------------------*\ | Cluster AccountLogin | 0x050E | |------------------------------------------------------------------------------| | Commands: | | | * GetSetupPIN | 0x00 | | * Login | 0x02 | | * Logout | 0x03 | |------------------------------------------------------------------------------| | Attributes: | | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * LoggedOut | 0x0000 | \*----------------------------------------------------------------------------*/ /* * Command GetSetupPIN */ class AccountLoginGetSetupPIN : public ClusterCommand { public: AccountLoginGetSetupPIN() : ClusterCommand("get-setup-pin") { AddArgument("TempAccountIdentifier", &mRequest.tempAccountIdentifier); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccountLogin::Id; constexpr chip::CommandId commandId = chip::app::Clusters::AccountLogin::Commands::GetSetupPIN::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRAccountLoginClusterGetSetupPINParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.tempAccountIdentifier = [[NSString alloc] initWithBytes:mRequest.tempAccountIdentifier.data() length:mRequest.tempAccountIdentifier.size() encoding:NSUTF8StringEncoding]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster getSetupPINWithParams:params completion: ^(MTRAccountLoginClusterGetSetupPINResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::AccountLogin::Commands::GetSetupPINResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::AccountLogin::Commands::GetSetupPINResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::AccountLogin::Commands::GetSetupPIN::Type mRequest; }; /* * Command Login */ class AccountLoginLogin : public ClusterCommand { public: AccountLoginLogin() : ClusterCommand("login") { AddArgument("TempAccountIdentifier", &mRequest.tempAccountIdentifier); AddArgument("SetupPIN", &mRequest.setupPIN); #if MTR_ENABLE_PROVISIONAL AddArgument("Node", 0, UINT64_MAX, &mRequest.node); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccountLogin::Id; constexpr chip::CommandId commandId = chip::app::Clusters::AccountLogin::Commands::Login::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRAccountLoginClusterLoginParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.tempAccountIdentifier = [[NSString alloc] initWithBytes:mRequest.tempAccountIdentifier.data() length:mRequest.tempAccountIdentifier.size() encoding:NSUTF8StringEncoding]; params.setupPIN = [[NSString alloc] initWithBytes:mRequest.setupPIN.data() length:mRequest.setupPIN.size() encoding:NSUTF8StringEncoding]; #if MTR_ENABLE_PROVISIONAL if (mRequest.node.HasValue()) { params.node = [NSNumber numberWithUnsignedLongLong:mRequest.node.Value()]; } else { params.node = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster loginWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::AccountLogin::Commands::Login::Type mRequest; }; /* * Command Logout */ class AccountLoginLogout : public ClusterCommand { public: AccountLoginLogout() : ClusterCommand("logout") { #if MTR_ENABLE_PROVISIONAL AddArgument("Node", 0, UINT64_MAX, &mRequest.node); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccountLogin::Id; constexpr chip::CommandId commandId = chip::app::Clusters::AccountLogin::Commands::Logout::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRAccountLoginClusterLogoutParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.node.HasValue()) { params.node = [NSNumber numberWithUnsignedLongLong:mRequest.node.Value()]; } else { params.node = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster logoutWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::AccountLogin::Commands::Logout::Type mRequest; }; /* * Attribute GeneratedCommandList */ class ReadAccountLoginGeneratedCommandList : public ReadAttribute { public: ReadAccountLoginGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadAccountLoginGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccountLogin::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccountLogin::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccountLogin.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccountLogin GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccountLoginGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeAccountLoginGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeAccountLoginGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccountLogin::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccountLogin::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccountLogin.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadAccountLoginAcceptedCommandList : public ReadAttribute { public: ReadAccountLoginAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadAccountLoginAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccountLogin::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccountLogin::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccountLogin.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccountLogin AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccountLoginAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeAccountLoginAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeAccountLoginAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccountLogin::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccountLogin::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccountLogin.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadAccountLoginEventList : public ReadAttribute { public: ReadAccountLoginEventList() : ReadAttribute("event-list") { } ~ReadAccountLoginEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccountLogin::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccountLogin::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccountLogin.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccountLogin EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccountLoginEventList : public SubscribeAttribute { public: SubscribeAttributeAccountLoginEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeAccountLoginEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccountLogin::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccountLogin::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccountLogin.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadAccountLoginAttributeList : public ReadAttribute { public: ReadAccountLoginAttributeList() : ReadAttribute("attribute-list") { } ~ReadAccountLoginAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccountLogin::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccountLogin::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccountLogin.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccountLogin AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccountLoginAttributeList : public SubscribeAttribute { public: SubscribeAttributeAccountLoginAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeAccountLoginAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccountLogin::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccountLogin::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccountLogin.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadAccountLoginFeatureMap : public ReadAttribute { public: ReadAccountLoginFeatureMap() : ReadAttribute("feature-map") { } ~ReadAccountLoginFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccountLogin::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccountLogin::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AccountLogin.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccountLogin FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccountLoginFeatureMap : public SubscribeAttribute { public: SubscribeAttributeAccountLoginFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeAccountLoginFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccountLogin::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccountLogin::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AccountLogin.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadAccountLoginClusterRevision : public ReadAttribute { public: ReadAccountLoginClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadAccountLoginClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccountLogin::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::AccountLogin::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AccountLogin.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("AccountLogin ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeAccountLoginClusterRevision : public SubscribeAttribute { public: SubscribeAttributeAccountLoginClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeAccountLoginClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::AccountLogin::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::AccountLogin::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AccountLogin.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster ContentControl | 0x050F | |------------------------------------------------------------------------------| | Commands: | | | * UpdatePIN | 0x00 | | * ResetPIN | 0x01 | | * Enable | 0x03 | | * Disable | 0x04 | | * AddBonusTime | 0x05 | | * SetScreenDailyTime | 0x06 | | * BlockUnratedContent | 0x07 | | * UnblockUnratedContent | 0x08 | | * SetOnDemandRatingThreshold | 0x09 | | * SetScheduledContentRatingThreshold | 0x0A | |------------------------------------------------------------------------------| | Attributes: | | | * Enabled | 0x0000 | | * OnDemandRatings | 0x0001 | | * OnDemandRatingThreshold | 0x0002 | | * ScheduledContentRatings | 0x0003 | | * ScheduledContentRatingThreshold | 0x0004 | | * ScreenDailyTime | 0x0005 | | * RemainingScreenTime | 0x0006 | | * BlockUnrated | 0x0007 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * RemainingScreenTimeExpired | 0x0000 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command UpdatePIN */ class ContentControlUpdatePIN : public ClusterCommand { public: ContentControlUpdatePIN() : ClusterCommand("update-pin") { #if MTR_ENABLE_PROVISIONAL AddArgument("OldPIN", &mRequest.oldPIN); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("NewPIN", &mRequest.newPIN); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ContentControl::Commands::UpdatePIN::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRContentControlClusterUpdatePINParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.oldPIN.HasValue()) { params.oldPIN = [[NSString alloc] initWithBytes:mRequest.oldPIN.Value().data() length:mRequest.oldPIN.Value().size() encoding:NSUTF8StringEncoding]; } else { params.oldPIN = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.newPIN = [[NSString alloc] initWithBytes:mRequest.newPIN.data() length:mRequest.newPIN.size() encoding:NSUTF8StringEncoding]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster updatePINWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ContentControl::Commands::UpdatePIN::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command ResetPIN */ class ContentControlResetPIN : public ClusterCommand { public: ContentControlResetPIN() : ClusterCommand("reset-pin") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ContentControl::Commands::ResetPIN::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRContentControlClusterResetPINParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster resetPINWithParams:params completion: ^(MTRContentControlClusterResetPINResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ContentControl::Commands::ResetPINResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ContentControl::Commands::ResetPINResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command Enable */ class ContentControlEnable : public ClusterCommand { public: ContentControlEnable() : ClusterCommand("enable") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ContentControl::Commands::Enable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRContentControlClusterEnableParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster enableWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command Disable */ class ContentControlDisable : public ClusterCommand { public: ContentControlDisable() : ClusterCommand("disable") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ContentControl::Commands::Disable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRContentControlClusterDisableParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster disableWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command AddBonusTime */ class ContentControlAddBonusTime : public ClusterCommand { public: ContentControlAddBonusTime() : ClusterCommand("add-bonus-time") { #if MTR_ENABLE_PROVISIONAL AddArgument("PINCode", &mRequest.PINCode); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("BonusTime", 0, UINT32_MAX, &mRequest.bonusTime); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ContentControl::Commands::AddBonusTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRContentControlClusterAddBonusTimeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.PINCode.HasValue()) { params.pinCode = [[NSString alloc] initWithBytes:mRequest.PINCode.Value().data() length:mRequest.PINCode.Value().size() encoding:NSUTF8StringEncoding]; } else { params.pinCode = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.bonusTime.HasValue()) { params.bonusTime = [NSNumber numberWithUnsignedInt:mRequest.bonusTime.Value()]; } else { params.bonusTime = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster addBonusTimeWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ContentControl::Commands::AddBonusTime::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetScreenDailyTime */ class ContentControlSetScreenDailyTime : public ClusterCommand { public: ContentControlSetScreenDailyTime() : ClusterCommand("set-screen-daily-time") { #if MTR_ENABLE_PROVISIONAL AddArgument("ScreenTime", 0, UINT32_MAX, &mRequest.screenTime); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ContentControl::Commands::SetScreenDailyTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRContentControlClusterSetScreenDailyTimeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.screenTime = [NSNumber numberWithUnsignedInt:mRequest.screenTime]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setScreenDailyTimeWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ContentControl::Commands::SetScreenDailyTime::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command BlockUnratedContent */ class ContentControlBlockUnratedContent : public ClusterCommand { public: ContentControlBlockUnratedContent() : ClusterCommand("block-unrated-content") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ContentControl::Commands::BlockUnratedContent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRContentControlClusterBlockUnratedContentParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster blockUnratedContentWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command UnblockUnratedContent */ class ContentControlUnblockUnratedContent : public ClusterCommand { public: ContentControlUnblockUnratedContent() : ClusterCommand("unblock-unrated-content") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ContentControl::Commands::UnblockUnratedContent::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRContentControlClusterUnblockUnratedContentParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster unblockUnratedContentWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetOnDemandRatingThreshold */ class ContentControlSetOnDemandRatingThreshold : public ClusterCommand { public: ContentControlSetOnDemandRatingThreshold() : ClusterCommand("set-on-demand-rating-threshold") { #if MTR_ENABLE_PROVISIONAL AddArgument("Rating", &mRequest.rating); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ContentControl::Commands::SetOnDemandRatingThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRContentControlClusterSetOnDemandRatingThresholdParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.rating = [[NSString alloc] initWithBytes:mRequest.rating.data() length:mRequest.rating.size() encoding:NSUTF8StringEncoding]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setOnDemandRatingThresholdWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ContentControl::Commands::SetOnDemandRatingThreshold::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetScheduledContentRatingThreshold */ class ContentControlSetScheduledContentRatingThreshold : public ClusterCommand { public: ContentControlSetScheduledContentRatingThreshold() : ClusterCommand("set-scheduled-content-rating-threshold") { #if MTR_ENABLE_PROVISIONAL AddArgument("Rating", &mRequest.rating); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ContentControl::Commands::SetScheduledContentRatingThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRContentControlClusterSetScheduledContentRatingThresholdParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.rating = [[NSString alloc] initWithBytes:mRequest.rating.data() length:mRequest.rating.size() encoding:NSUTF8StringEncoding]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setScheduledContentRatingThresholdWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ContentControl::Commands::SetScheduledContentRatingThreshold::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Enabled */ class ReadContentControlEnabled : public ReadAttribute { public: ReadContentControlEnabled() : ReadAttribute("enabled") { } ~ReadContentControlEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentControl::Attributes::Enabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.Enabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentControl Enabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentControlEnabled : public SubscribeAttribute { public: SubscribeAttributeContentControlEnabled() : SubscribeAttribute("enabled") { } ~SubscribeAttributeContentControlEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentControl::Attributes::Enabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.Enabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute OnDemandRatings */ class ReadContentControlOnDemandRatings : public ReadAttribute { public: ReadContentControlOnDemandRatings() : ReadAttribute("on-demand-ratings") { } ~ReadContentControlOnDemandRatings() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentControl::Attributes::OnDemandRatings::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOnDemandRatingsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.OnDemandRatings response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentControl OnDemandRatings read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentControlOnDemandRatings : public SubscribeAttribute { public: SubscribeAttributeContentControlOnDemandRatings() : SubscribeAttribute("on-demand-ratings") { } ~SubscribeAttributeContentControlOnDemandRatings() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentControl::Attributes::OnDemandRatings::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOnDemandRatingsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.OnDemandRatings response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute OnDemandRatingThreshold */ class ReadContentControlOnDemandRatingThreshold : public ReadAttribute { public: ReadContentControlOnDemandRatingThreshold() : ReadAttribute("on-demand-rating-threshold") { } ~ReadContentControlOnDemandRatingThreshold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentControl::Attributes::OnDemandRatingThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOnDemandRatingThresholdWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.OnDemandRatingThreshold response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentControl OnDemandRatingThreshold read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentControlOnDemandRatingThreshold : public SubscribeAttribute { public: SubscribeAttributeContentControlOnDemandRatingThreshold() : SubscribeAttribute("on-demand-rating-threshold") { } ~SubscribeAttributeContentControlOnDemandRatingThreshold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentControl::Attributes::OnDemandRatingThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOnDemandRatingThresholdWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.OnDemandRatingThreshold response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ScheduledContentRatings */ class ReadContentControlScheduledContentRatings : public ReadAttribute { public: ReadContentControlScheduledContentRatings() : ReadAttribute("scheduled-content-ratings") { } ~ReadContentControlScheduledContentRatings() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentControl::Attributes::ScheduledContentRatings::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeScheduledContentRatingsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.ScheduledContentRatings response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentControl ScheduledContentRatings read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentControlScheduledContentRatings : public SubscribeAttribute { public: SubscribeAttributeContentControlScheduledContentRatings() : SubscribeAttribute("scheduled-content-ratings") { } ~SubscribeAttributeContentControlScheduledContentRatings() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentControl::Attributes::ScheduledContentRatings::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeScheduledContentRatingsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.ScheduledContentRatings response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ScheduledContentRatingThreshold */ class ReadContentControlScheduledContentRatingThreshold : public ReadAttribute { public: ReadContentControlScheduledContentRatingThreshold() : ReadAttribute("scheduled-content-rating-threshold") { } ~ReadContentControlScheduledContentRatingThreshold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentControl::Attributes::ScheduledContentRatingThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeScheduledContentRatingThresholdWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.ScheduledContentRatingThreshold response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentControl ScheduledContentRatingThreshold read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentControlScheduledContentRatingThreshold : public SubscribeAttribute { public: SubscribeAttributeContentControlScheduledContentRatingThreshold() : SubscribeAttribute("scheduled-content-rating-threshold") { } ~SubscribeAttributeContentControlScheduledContentRatingThreshold() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentControl::Attributes::ScheduledContentRatingThreshold::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeScheduledContentRatingThresholdWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.ScheduledContentRatingThreshold response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ScreenDailyTime */ class ReadContentControlScreenDailyTime : public ReadAttribute { public: ReadContentControlScreenDailyTime() : ReadAttribute("screen-daily-time") { } ~ReadContentControlScreenDailyTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentControl::Attributes::ScreenDailyTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeScreenDailyTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.ScreenDailyTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentControl ScreenDailyTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentControlScreenDailyTime : public SubscribeAttribute { public: SubscribeAttributeContentControlScreenDailyTime() : SubscribeAttribute("screen-daily-time") { } ~SubscribeAttributeContentControlScreenDailyTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentControl::Attributes::ScreenDailyTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeScreenDailyTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.ScreenDailyTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute RemainingScreenTime */ class ReadContentControlRemainingScreenTime : public ReadAttribute { public: ReadContentControlRemainingScreenTime() : ReadAttribute("remaining-screen-time") { } ~ReadContentControlRemainingScreenTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentControl::Attributes::RemainingScreenTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRemainingScreenTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.RemainingScreenTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentControl RemainingScreenTime read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentControlRemainingScreenTime : public SubscribeAttribute { public: SubscribeAttributeContentControlRemainingScreenTime() : SubscribeAttribute("remaining-screen-time") { } ~SubscribeAttributeContentControlRemainingScreenTime() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentControl::Attributes::RemainingScreenTime::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRemainingScreenTimeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.RemainingScreenTime response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute BlockUnrated */ class ReadContentControlBlockUnrated : public ReadAttribute { public: ReadContentControlBlockUnrated() : ReadAttribute("block-unrated") { } ~ReadContentControlBlockUnrated() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentControl::Attributes::BlockUnrated::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBlockUnratedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.BlockUnrated response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentControl BlockUnrated read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentControlBlockUnrated : public SubscribeAttribute { public: SubscribeAttributeContentControlBlockUnrated() : SubscribeAttribute("block-unrated") { } ~SubscribeAttributeContentControlBlockUnrated() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentControl::Attributes::BlockUnrated::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBlockUnratedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.BlockUnrated response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadContentControlGeneratedCommandList : public ReadAttribute { public: ReadContentControlGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadContentControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentControl GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentControlGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeContentControlGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeContentControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadContentControlAcceptedCommandList : public ReadAttribute { public: ReadContentControlAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadContentControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentControl AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentControlAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeContentControlAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeContentControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadContentControlEventList : public ReadAttribute { public: ReadContentControlEventList() : ReadAttribute("event-list") { } ~ReadContentControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentControl EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentControlEventList : public SubscribeAttribute { public: SubscribeAttributeContentControlEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeContentControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadContentControlAttributeList : public ReadAttribute { public: ReadContentControlAttributeList() : ReadAttribute("attribute-list") { } ~ReadContentControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentControl AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentControlAttributeList : public SubscribeAttribute { public: SubscribeAttributeContentControlAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeContentControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadContentControlFeatureMap : public ReadAttribute { public: ReadContentControlFeatureMap() : ReadAttribute("feature-map") { } ~ReadContentControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentControl FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentControlFeatureMap : public SubscribeAttribute { public: SubscribeAttributeContentControlFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeContentControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadContentControlClusterRevision : public ReadAttribute { public: ReadContentControlClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadContentControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentControl ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentControlClusterRevision : public SubscribeAttribute { public: SubscribeAttributeContentControlClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeContentControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster ContentAppObserver | 0x0510 | |------------------------------------------------------------------------------| | Commands: | | | * ContentAppMessage | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command ContentAppMessage */ class ContentAppObserverContentAppMessage : public ClusterCommand { public: ContentAppObserverContentAppMessage() : ClusterCommand("content-app-message") { #if MTR_ENABLE_PROVISIONAL AddArgument("Data", &mRequest.data); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("EncodingHint", &mRequest.encodingHint); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentAppObserver::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ContentAppObserver::Commands::ContentAppMessage::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentAppObserver alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRContentAppObserverClusterContentAppMessageParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.data.HasValue()) { params.data = [[NSString alloc] initWithBytes:mRequest.data.Value().data() length:mRequest.data.Value().size() encoding:NSUTF8StringEncoding]; } else { params.data = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.encodingHint = [[NSString alloc] initWithBytes:mRequest.encodingHint.data() length:mRequest.encodingHint.size() encoding:NSUTF8StringEncoding]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster contentAppMessageWithParams:params completion: ^(MTRContentAppObserverClusterContentAppMessageResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ContentAppObserver::Commands::ContentAppMessageResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ContentAppObserver::Commands::ContentAppMessageResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ContentAppObserver::Commands::ContentAppMessage::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadContentAppObserverGeneratedCommandList : public ReadAttribute { public: ReadContentAppObserverGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadContentAppObserverGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentAppObserver::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentAppObserver::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentAppObserver alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentAppObserver.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentAppObserver GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentAppObserverGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeContentAppObserverGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeContentAppObserverGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentAppObserver::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentAppObserver::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentAppObserver alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentAppObserver.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadContentAppObserverAcceptedCommandList : public ReadAttribute { public: ReadContentAppObserverAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadContentAppObserverAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentAppObserver::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentAppObserver::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentAppObserver alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentAppObserver.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentAppObserver AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentAppObserverAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeContentAppObserverAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeContentAppObserverAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentAppObserver::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentAppObserver::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentAppObserver alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentAppObserver.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadContentAppObserverEventList : public ReadAttribute { public: ReadContentAppObserverEventList() : ReadAttribute("event-list") { } ~ReadContentAppObserverEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentAppObserver::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentAppObserver::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentAppObserver alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentAppObserver.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentAppObserver EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentAppObserverEventList : public SubscribeAttribute { public: SubscribeAttributeContentAppObserverEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeContentAppObserverEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentAppObserver::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentAppObserver::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentAppObserver alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentAppObserver.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadContentAppObserverAttributeList : public ReadAttribute { public: ReadContentAppObserverAttributeList() : ReadAttribute("attribute-list") { } ~ReadContentAppObserverAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentAppObserver::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentAppObserver::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentAppObserver alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentAppObserver.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentAppObserver AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentAppObserverAttributeList : public SubscribeAttribute { public: SubscribeAttributeContentAppObserverAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeContentAppObserverAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentAppObserver::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentAppObserver::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentAppObserver alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentAppObserver.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadContentAppObserverFeatureMap : public ReadAttribute { public: ReadContentAppObserverFeatureMap() : ReadAttribute("feature-map") { } ~ReadContentAppObserverFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentAppObserver::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentAppObserver::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentAppObserver alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentAppObserver.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentAppObserver FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentAppObserverFeatureMap : public SubscribeAttribute { public: SubscribeAttributeContentAppObserverFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeContentAppObserverFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentAppObserver::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentAppObserver::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentAppObserver alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentAppObserver.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadContentAppObserverClusterRevision : public ReadAttribute { public: ReadContentAppObserverClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadContentAppObserverClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentAppObserver::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ContentAppObserver::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentAppObserver alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentAppObserver.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ContentAppObserver ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeContentAppObserverClusterRevision : public SubscribeAttribute { public: SubscribeAttributeContentAppObserverClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeContentAppObserverClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ContentAppObserver::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ContentAppObserver::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterContentAppObserver alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentAppObserver.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster ZoneManagement | 0x0550 | |------------------------------------------------------------------------------| | Commands: | | | * CreateTwoDCartesianZone | 0x00 | | * UpdateTwoDCartesianZone | 0x02 | | * GetTwoDCartesianZone | 0x03 | | * RemoveZone | 0x05 | |------------------------------------------------------------------------------| | Attributes: | | | * SupportedZoneSources | 0x0000 | | * Zones | 0x0001 | | * TimeControl | 0x0002 | | * Sensitivity | 0x0003 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * ZoneTriggered | 0x0000 | | * ZoneStopped | 0x0001 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command CreateTwoDCartesianZone */ class ZoneManagementCreateTwoDCartesianZone : public ClusterCommand { public: ZoneManagementCreateTwoDCartesianZone() : ClusterCommand("create-two-dcartesian-zone") , mComplex_Zone(&mRequest.zone) { #if MTR_ENABLE_PROVISIONAL AddArgument("Zone", &mComplex_Zone); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ZoneManagement::Commands::CreateTwoDCartesianZone::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRZoneManagementClusterCreateTwoDCartesianZoneParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.zone = [MTRZoneManagementClusterTwoDCartesianZoneStruct new]; params.zone.name = [[NSString alloc] initWithBytes:mRequest.zone.name.data() length:mRequest.zone.name.size() encoding:NSUTF8StringEncoding]; params.zone.use = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.zone.use)]; { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.zone.vertices) { MTRZoneManagementClusterTwoDCartesianVertexStruct * newElement_1; newElement_1 = [MTRZoneManagementClusterTwoDCartesianVertexStruct new]; newElement_1.x = [NSNumber numberWithUnsignedShort:entry_1.x]; newElement_1.y = [NSNumber numberWithUnsignedShort:entry_1.y]; [array_1 addObject:newElement_1]; } params.zone.vertices = array_1; } if (mRequest.zone.color.HasValue()) { params.zone.color = [[NSString alloc] initWithBytes:mRequest.zone.color.Value().data() length:mRequest.zone.color.Value().size() encoding:NSUTF8StringEncoding]; } else { params.zone.color = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster createTwoDCartesianZoneWithParams:params completion: ^(MTRZoneManagementClusterCreateTwoDCartesianZoneResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ZoneManagement::Commands::CreateTwoDCartesianZoneResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ZoneManagement::Commands::CreateTwoDCartesianZoneResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ZoneManagement::Commands::CreateTwoDCartesianZone::Type mRequest; TypedComplexArgument mComplex_Zone; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command UpdateTwoDCartesianZone */ class ZoneManagementUpdateTwoDCartesianZone : public ClusterCommand { public: ZoneManagementUpdateTwoDCartesianZone() : ClusterCommand("update-two-dcartesian-zone") , mComplex_Zone(&mRequest.zone) { #if MTR_ENABLE_PROVISIONAL AddArgument("ZoneID", 0, UINT16_MAX, &mRequest.zoneID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Zone", &mComplex_Zone); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ZoneManagement::Commands::UpdateTwoDCartesianZone::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRZoneManagementClusterUpdateTwoDCartesianZoneParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.zoneID = [NSNumber numberWithUnsignedShort:mRequest.zoneID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.zone = [MTRZoneManagementClusterTwoDCartesianZoneStruct new]; params.zone.name = [[NSString alloc] initWithBytes:mRequest.zone.name.data() length:mRequest.zone.name.size() encoding:NSUTF8StringEncoding]; params.zone.use = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.zone.use)]; { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.zone.vertices) { MTRZoneManagementClusterTwoDCartesianVertexStruct * newElement_1; newElement_1 = [MTRZoneManagementClusterTwoDCartesianVertexStruct new]; newElement_1.x = [NSNumber numberWithUnsignedShort:entry_1.x]; newElement_1.y = [NSNumber numberWithUnsignedShort:entry_1.y]; [array_1 addObject:newElement_1]; } params.zone.vertices = array_1; } if (mRequest.zone.color.HasValue()) { params.zone.color = [[NSString alloc] initWithBytes:mRequest.zone.color.Value().data() length:mRequest.zone.color.Value().size() encoding:NSUTF8StringEncoding]; } else { params.zone.color = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster updateTwoDCartesianZoneWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ZoneManagement::Commands::UpdateTwoDCartesianZone::Type mRequest; TypedComplexArgument mComplex_Zone; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command GetTwoDCartesianZone */ class ZoneManagementGetTwoDCartesianZone : public ClusterCommand { public: ZoneManagementGetTwoDCartesianZone() : ClusterCommand("get-two-dcartesian-zone") { #if MTR_ENABLE_PROVISIONAL AddArgument("ZoneID", 0, UINT16_MAX, &mRequest.zoneID); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ZoneManagement::Commands::GetTwoDCartesianZone::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRZoneManagementClusterGetTwoDCartesianZoneParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.zoneID.HasValue()) { if (mRequest.zoneID.Value().IsNull()) { params.zoneID = nil; } else { params.zoneID = [NSNumber numberWithUnsignedShort:mRequest.zoneID.Value().Value()]; } } else { params.zoneID = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster getTwoDCartesianZoneWithParams:params completion: ^(MTRZoneManagementClusterGetTwoDCartesianZoneResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::ZoneManagement::Commands::GetTwoDCartesianZoneResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::ZoneManagement::Commands::GetTwoDCartesianZoneResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ZoneManagement::Commands::GetTwoDCartesianZone::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command RemoveZone */ class ZoneManagementRemoveZone : public ClusterCommand { public: ZoneManagementRemoveZone() : ClusterCommand("remove-zone") { #if MTR_ENABLE_PROVISIONAL AddArgument("ZoneID", 0, UINT16_MAX, &mRequest.zoneID); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::ZoneManagement::Commands::RemoveZone::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRZoneManagementClusterRemoveZoneParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.zoneID = [NSNumber numberWithUnsignedShort:mRequest.zoneID]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster removeZoneWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::ZoneManagement::Commands::RemoveZone::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedZoneSources */ class ReadZoneManagementSupportedZoneSources : public ReadAttribute { public: ReadZoneManagementSupportedZoneSources() : ReadAttribute("supported-zone-sources") { } ~ReadZoneManagementSupportedZoneSources() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ZoneManagement::Attributes::SupportedZoneSources::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedZoneSourcesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.SupportedZoneSources response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ZoneManagement SupportedZoneSources read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeZoneManagementSupportedZoneSources : public SubscribeAttribute { public: SubscribeAttributeZoneManagementSupportedZoneSources() : SubscribeAttribute("supported-zone-sources") { } ~SubscribeAttributeZoneManagementSupportedZoneSources() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ZoneManagement::Attributes::SupportedZoneSources::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedZoneSourcesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.SupportedZoneSources response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Zones */ class ReadZoneManagementZones : public ReadAttribute { public: ReadZoneManagementZones() : ReadAttribute("zones") { } ~ReadZoneManagementZones() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ZoneManagement::Attributes::Zones::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeZonesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.Zones response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ZoneManagement Zones read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeZoneManagementZones : public SubscribeAttribute { public: SubscribeAttributeZoneManagementZones() : SubscribeAttribute("zones") { } ~SubscribeAttributeZoneManagementZones() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ZoneManagement::Attributes::Zones::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeZonesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.Zones response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute TimeControl */ class ReadZoneManagementTimeControl : public ReadAttribute { public: ReadZoneManagementTimeControl() : ReadAttribute("time-control") { } ~ReadZoneManagementTimeControl() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ZoneManagement::Attributes::TimeControl::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTimeControlWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.TimeControl response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ZoneManagement TimeControl read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteZoneManagementTimeControl : public WriteAttribute { public: WriteZoneManagementTimeControl() : WriteAttribute("time-control") , mComplex(&mValue) { AddArgument("attr-name", "time-control"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteZoneManagementTimeControl() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ZoneManagement::Attributes::TimeControl::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSArray * _Nonnull value; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { MTRZoneManagementClusterZoneTriggeringTimeControlStruct * newElement_0; newElement_0 = [MTRZoneManagementClusterZoneTriggeringTimeControlStruct new]; newElement_0.initialDuration = [NSNumber numberWithUnsignedShort:entry_0.initialDuration]; newElement_0.augmentationDuration = [NSNumber numberWithUnsignedShort:entry_0.augmentationDuration]; newElement_0.maxDuration = [NSNumber numberWithUnsignedInt:entry_0.maxDuration]; newElement_0.blindDuration = [NSNumber numberWithUnsignedShort:entry_0.blindDuration]; [array_0 addObject:newElement_0]; } value = array_0; } [cluster writeAttributeTimeControlWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ZoneManagement TimeControl write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::List mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeZoneManagementTimeControl : public SubscribeAttribute { public: SubscribeAttributeZoneManagementTimeControl() : SubscribeAttribute("time-control") { } ~SubscribeAttributeZoneManagementTimeControl() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ZoneManagement::Attributes::TimeControl::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTimeControlWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.TimeControl response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Sensitivity */ class ReadZoneManagementSensitivity : public ReadAttribute { public: ReadZoneManagementSensitivity() : ReadAttribute("sensitivity") { } ~ReadZoneManagementSensitivity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ZoneManagement::Attributes::Sensitivity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSensitivityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.Sensitivity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ZoneManagement Sensitivity read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteZoneManagementSensitivity : public WriteAttribute { public: WriteZoneManagementSensitivity() : WriteAttribute("sensitivity") { AddArgument("attr-name", "sensitivity"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteZoneManagementSensitivity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ZoneManagement::Attributes::Sensitivity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeSensitivityWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("ZoneManagement Sensitivity write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeZoneManagementSensitivity : public SubscribeAttribute { public: SubscribeAttributeZoneManagementSensitivity() : SubscribeAttribute("sensitivity") { } ~SubscribeAttributeZoneManagementSensitivity() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ZoneManagement::Attributes::Sensitivity::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSensitivityWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.Sensitivity response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadZoneManagementGeneratedCommandList : public ReadAttribute { public: ReadZoneManagementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadZoneManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ZoneManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ZoneManagement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeZoneManagementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeZoneManagementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeZoneManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ZoneManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadZoneManagementAcceptedCommandList : public ReadAttribute { public: ReadZoneManagementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadZoneManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ZoneManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ZoneManagement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeZoneManagementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeZoneManagementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeZoneManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ZoneManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadZoneManagementEventList : public ReadAttribute { public: ReadZoneManagementEventList() : ReadAttribute("event-list") { } ~ReadZoneManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ZoneManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ZoneManagement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeZoneManagementEventList : public SubscribeAttribute { public: SubscribeAttributeZoneManagementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeZoneManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ZoneManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadZoneManagementAttributeList : public ReadAttribute { public: ReadZoneManagementAttributeList() : ReadAttribute("attribute-list") { } ~ReadZoneManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ZoneManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ZoneManagement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeZoneManagementAttributeList : public SubscribeAttribute { public: SubscribeAttributeZoneManagementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeZoneManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ZoneManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadZoneManagementFeatureMap : public ReadAttribute { public: ReadZoneManagementFeatureMap() : ReadAttribute("feature-map") { } ~ReadZoneManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ZoneManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ZoneManagement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeZoneManagementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeZoneManagementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeZoneManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ZoneManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadZoneManagementClusterRevision : public ReadAttribute { public: ReadZoneManagementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadZoneManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::ZoneManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("ZoneManagement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeZoneManagementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeZoneManagementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeZoneManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::ZoneManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::ZoneManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterZoneManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ZoneManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster CameraAvStreamManagement | 0x0551 | |------------------------------------------------------------------------------| | Commands: | | | * AudioStreamAllocate | 0x00 | | * AudioStreamDeallocate | 0x02 | | * VideoStreamAllocate | 0x03 | | * VideoStreamModify | 0x05 | | * VideoStreamDeallocate | 0x06 | | * SnapshotStreamAllocate | 0x07 | | * SnapshotStreamDeallocate | 0x09 | | * SetStreamPriorities | 0x0A | | * CaptureSnapshot | 0x0B | | * SetViewport | 0x0D | | * SetImageRotation | 0x0E | | * SetImageFlipHorizontal | 0x0F | | * SetImageFlipVertical | 0x10 | |------------------------------------------------------------------------------| | Attributes: | | | * MaxConcurrentVideoEncoders | 0x0000 | | * MaxEncodedPixelRate | 0x0001 | | * VideoSensorParams | 0x0002 | | * NightVisionCapable | 0x0003 | | * MinViewport | 0x0004 | | * RateDistortionTradeOffPoints | 0x0005 | | * MaxPreRollBufferSize | 0x0006 | | * MicrophoneCapabilities | 0x0007 | | * SpeakerCapabilities | 0x0008 | | * TwoWayTalkSupport | 0x0009 | | * SupportedSnapshotParams | 0x000A | | * MaxNetworkBandwidth | 0x000B | | * CurrentFrameRate | 0x000C | | * HDRModeEnabled | 0x000D | | * CurrentVideoCodecs | 0x000E | | * CurrentSnapshotConfig | 0x000F | | * FabricsUsingCamera | 0x0010 | | * AllocatedVideoStreams | 0x0011 | | * AllocatedAudioStreams | 0x0012 | | * AllocatedSnapshotStreams | 0x0013 | | * RankedVideoStreamPrioritiesList | 0x0014 | | * SoftRecordingPrivacyModeEnabled | 0x0015 | | * SoftLivestreamPrivacyModeEnabled | 0x0016 | | * HardPrivacyModeOn | 0x0017 | | * NightVision | 0x0018 | | * NightVisionIllum | 0x0019 | | * AWBEnabled | 0x001A | | * AutoShutterSpeedEnabled | 0x001B | | * AutoISOEnabled | 0x001C | | * Viewport | 0x001D | | * SpeakerMuted | 0x001E | | * SpeakerVolumeLevel | 0x001F | | * SpeakerMaxLevel | 0x0020 | | * SpeakerMinLevel | 0x0021 | | * MicrophoneMuted | 0x0022 | | * MicrophoneVolumeLevel | 0x0023 | | * MicrophoneMaxLevel | 0x0024 | | * MicrophoneMinLevel | 0x0025 | | * MicrophoneAGCEnabled | 0x0026 | | * ImageRotation | 0x0027 | | * ImageFlipHorizontal | 0x0028 | | * ImageFlipVertical | 0x0029 | | * LocalVideoRecordingEnabled | 0x002A | | * LocalSnapshotRecordingEnabled | 0x002B | | * StatusLightEnabled | 0x002C | | * StatusLightBrightness | 0x002D | | * DepthSensorStatus | 0x002E | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * VideoStreamChanged | 0x0000 | | * AudioStreamChanged | 0x0001 | | * SnapshotStreamChanged | 0x0002 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command AudioStreamAllocate */ class CameraAvStreamManagementAudioStreamAllocate : public ClusterCommand { public: CameraAvStreamManagementAudioStreamAllocate() : ClusterCommand("audio-stream-allocate") { #if MTR_ENABLE_PROVISIONAL AddArgument("StreamType", 0, UINT8_MAX, &mRequest.streamType); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("AudioCodec", 0, UINT8_MAX, &mRequest.audioCodec); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ChannelCount", 0, UINT8_MAX, &mRequest.channelCount); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("SampleRate", 0, UINT32_MAX, &mRequest.sampleRate); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("BitRate", 0, UINT32_MAX, &mRequest.bitRate); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("BitDepth", 0, UINT8_MAX, &mRequest.bitDepth); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::AudioStreamAllocate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRCameraAVStreamManagementClusterAudioStreamAllocateParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.streamType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.streamType)]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.audioCodec = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.audioCodec)]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.channelCount = [NSNumber numberWithUnsignedChar:mRequest.channelCount]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.sampleRate = [NSNumber numberWithUnsignedInt:mRequest.sampleRate]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.bitRate = [NSNumber numberWithUnsignedInt:mRequest.bitRate]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.bitDepth = [NSNumber numberWithUnsignedChar:mRequest.bitDepth]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster audioStreamAllocateWithParams:params completion: ^(MTRCameraAVStreamManagementClusterAudioStreamAllocateResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::CameraAvStreamManagement::Commands::AudioStreamAllocateResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::CameraAvStreamManagement::Commands::AudioStreamAllocateResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::CameraAvStreamManagement::Commands::AudioStreamAllocate::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command AudioStreamDeallocate */ class CameraAvStreamManagementAudioStreamDeallocate : public ClusterCommand { public: CameraAvStreamManagementAudioStreamDeallocate() : ClusterCommand("audio-stream-deallocate") { #if MTR_ENABLE_PROVISIONAL AddArgument("AudioStreamID", 0, UINT16_MAX, &mRequest.audioStreamID); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::AudioStreamDeallocate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRCameraAVStreamManagementClusterAudioStreamDeallocateParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.audioStreamID = [NSNumber numberWithUnsignedShort:mRequest.audioStreamID]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster audioStreamDeallocateWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::CameraAvStreamManagement::Commands::AudioStreamDeallocate::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command VideoStreamAllocate */ class CameraAvStreamManagementVideoStreamAllocate : public ClusterCommand { public: CameraAvStreamManagementVideoStreamAllocate() : ClusterCommand("video-stream-allocate") , mComplex_MinResolution(&mRequest.minResolution) , mComplex_MaxResolution(&mRequest.maxResolution) { #if MTR_ENABLE_PROVISIONAL AddArgument("StreamType", 0, UINT8_MAX, &mRequest.streamType); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("VideoCodec", 0, UINT8_MAX, &mRequest.videoCodec); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MinFrameRate", 0, UINT16_MAX, &mRequest.minFrameRate); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MaxFrameRate", 0, UINT16_MAX, &mRequest.maxFrameRate); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MinResolution", &mComplex_MinResolution); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MaxResolution", &mComplex_MaxResolution); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MinBitRate", 0, UINT32_MAX, &mRequest.minBitRate); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MaxBitRate", 0, UINT32_MAX, &mRequest.maxBitRate); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MinFragmentLen", 0, UINT16_MAX, &mRequest.minFragmentLen); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MaxFragmentLen", 0, UINT16_MAX, &mRequest.maxFragmentLen); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("WatermarkEnabled", 0, 1, &mRequest.watermarkEnabled); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("OSDEnabled", 0, 1, &mRequest.OSDEnabled); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::VideoStreamAllocate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRCameraAVStreamManagementClusterVideoStreamAllocateParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.streamType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.streamType)]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.videoCodec = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.videoCodec)]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.minFrameRate = [NSNumber numberWithUnsignedShort:mRequest.minFrameRate]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.maxFrameRate = [NSNumber numberWithUnsignedShort:mRequest.maxFrameRate]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.minResolution = [MTRCameraAVStreamManagementClusterVideoResolutionStruct new]; params.minResolution.width = [NSNumber numberWithUnsignedShort:mRequest.minResolution.width]; params.minResolution.height = [NSNumber numberWithUnsignedShort:mRequest.minResolution.height]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.maxResolution = [MTRCameraAVStreamManagementClusterVideoResolutionStruct new]; params.maxResolution.width = [NSNumber numberWithUnsignedShort:mRequest.maxResolution.width]; params.maxResolution.height = [NSNumber numberWithUnsignedShort:mRequest.maxResolution.height]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.minBitRate = [NSNumber numberWithUnsignedInt:mRequest.minBitRate]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.maxBitRate = [NSNumber numberWithUnsignedInt:mRequest.maxBitRate]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.minFragmentLen = [NSNumber numberWithUnsignedShort:mRequest.minFragmentLen]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.maxFragmentLen = [NSNumber numberWithUnsignedShort:mRequest.maxFragmentLen]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.watermarkEnabled.HasValue()) { params.watermarkEnabled = [NSNumber numberWithBool:mRequest.watermarkEnabled.Value()]; } else { params.watermarkEnabled = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.OSDEnabled.HasValue()) { params.osdEnabled = [NSNumber numberWithBool:mRequest.OSDEnabled.Value()]; } else { params.osdEnabled = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster videoStreamAllocateWithParams:params completion: ^(MTRCameraAVStreamManagementClusterVideoStreamAllocateResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::CameraAvStreamManagement::Commands::VideoStreamAllocateResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::CameraAvStreamManagement::Commands::VideoStreamAllocateResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::CameraAvStreamManagement::Commands::VideoStreamAllocate::Type mRequest; TypedComplexArgument mComplex_MinResolution; TypedComplexArgument mComplex_MaxResolution; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command VideoStreamModify */ class CameraAvStreamManagementVideoStreamModify : public ClusterCommand { public: CameraAvStreamManagementVideoStreamModify() : ClusterCommand("video-stream-modify") , mComplex_Resolution(&mRequest.resolution) { #if MTR_ENABLE_PROVISIONAL AddArgument("VideoStreamID", 0, UINT16_MAX, &mRequest.videoStreamID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Resolution", &mComplex_Resolution); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("WatermarkEnabled", 0, 1, &mRequest.watermarkEnabled); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("OSDEnabled", 0, 1, &mRequest.OSDEnabled); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::VideoStreamModify::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRCameraAVStreamManagementClusterVideoStreamModifyParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.videoStreamID = [NSNumber numberWithUnsignedShort:mRequest.videoStreamID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.resolution.HasValue()) { params.resolution = [MTRCameraAVStreamManagementClusterVideoResolutionStruct new]; params.resolution.width = [NSNumber numberWithUnsignedShort:mRequest.resolution.Value().width]; params.resolution.height = [NSNumber numberWithUnsignedShort:mRequest.resolution.Value().height]; } else { params.resolution = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.watermarkEnabled.HasValue()) { params.watermarkEnabled = [NSNumber numberWithBool:mRequest.watermarkEnabled.Value()]; } else { params.watermarkEnabled = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.OSDEnabled.HasValue()) { params.osdEnabled = [NSNumber numberWithBool:mRequest.OSDEnabled.Value()]; } else { params.osdEnabled = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster videoStreamModifyWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::CameraAvStreamManagement::Commands::VideoStreamModify::Type mRequest; TypedComplexArgument> mComplex_Resolution; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command VideoStreamDeallocate */ class CameraAvStreamManagementVideoStreamDeallocate : public ClusterCommand { public: CameraAvStreamManagementVideoStreamDeallocate() : ClusterCommand("video-stream-deallocate") { #if MTR_ENABLE_PROVISIONAL AddArgument("VideoStreamID", 0, UINT16_MAX, &mRequest.videoStreamID); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::VideoStreamDeallocate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRCameraAVStreamManagementClusterVideoStreamDeallocateParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.videoStreamID = [NSNumber numberWithUnsignedShort:mRequest.videoStreamID]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster videoStreamDeallocateWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::CameraAvStreamManagement::Commands::VideoStreamDeallocate::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SnapshotStreamAllocate */ class CameraAvStreamManagementSnapshotStreamAllocate : public ClusterCommand { public: CameraAvStreamManagementSnapshotStreamAllocate() : ClusterCommand("snapshot-stream-allocate") , mComplex_MinResolution(&mRequest.minResolution) , mComplex_MaxResolution(&mRequest.maxResolution) { #if MTR_ENABLE_PROVISIONAL AddArgument("ImageCodec", 0, UINT8_MAX, &mRequest.imageCodec); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("FrameRate", 0, UINT16_MAX, &mRequest.frameRate); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("BitRate", 0, UINT32_MAX, &mRequest.bitRate); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MinResolution", &mComplex_MinResolution); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MaxResolution", &mComplex_MaxResolution); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Quality", 0, UINT8_MAX, &mRequest.quality); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SnapshotStreamAllocate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRCameraAVStreamManagementClusterSnapshotStreamAllocateParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.imageCodec = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.imageCodec)]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.frameRate = [NSNumber numberWithUnsignedShort:mRequest.frameRate]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.bitRate = [NSNumber numberWithUnsignedInt:mRequest.bitRate]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.minResolution = [MTRCameraAVStreamManagementClusterVideoResolutionStruct new]; params.minResolution.width = [NSNumber numberWithUnsignedShort:mRequest.minResolution.width]; params.minResolution.height = [NSNumber numberWithUnsignedShort:mRequest.minResolution.height]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.maxResolution = [MTRCameraAVStreamManagementClusterVideoResolutionStruct new]; params.maxResolution.width = [NSNumber numberWithUnsignedShort:mRequest.maxResolution.width]; params.maxResolution.height = [NSNumber numberWithUnsignedShort:mRequest.maxResolution.height]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.quality = [NSNumber numberWithUnsignedChar:mRequest.quality]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster snapshotStreamAllocateWithParams:params completion: ^(MTRCameraAVStreamManagementClusterSnapshotStreamAllocateResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::CameraAvStreamManagement::Commands::SnapshotStreamAllocateResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::CameraAvStreamManagement::Commands::SnapshotStreamAllocateResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::CameraAvStreamManagement::Commands::SnapshotStreamAllocate::Type mRequest; TypedComplexArgument mComplex_MinResolution; TypedComplexArgument mComplex_MaxResolution; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SnapshotStreamDeallocate */ class CameraAvStreamManagementSnapshotStreamDeallocate : public ClusterCommand { public: CameraAvStreamManagementSnapshotStreamDeallocate() : ClusterCommand("snapshot-stream-deallocate") { #if MTR_ENABLE_PROVISIONAL AddArgument("SnapshotStreamID", 0, UINT16_MAX, &mRequest.snapshotStreamID); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SnapshotStreamDeallocate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRCameraAVStreamManagementClusterSnapshotStreamDeallocateParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.snapshotStreamID = [NSNumber numberWithUnsignedShort:mRequest.snapshotStreamID]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster snapshotStreamDeallocateWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::CameraAvStreamManagement::Commands::SnapshotStreamDeallocate::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetStreamPriorities */ class CameraAvStreamManagementSetStreamPriorities : public ClusterCommand { public: CameraAvStreamManagementSetStreamPriorities() : ClusterCommand("set-stream-priorities") , mComplex_StreamPriorities(&mRequest.streamPriorities) { #if MTR_ENABLE_PROVISIONAL AddArgument("StreamPriorities", &mComplex_StreamPriorities); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetStreamPriorities::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRCameraAVStreamManagementClusterSetStreamPrioritiesParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.streamPriorities) { NSNumber * newElement_0; newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; [array_0 addObject:newElement_0]; } params.streamPriorities = array_0; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setStreamPrioritiesWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::CameraAvStreamManagement::Commands::SetStreamPriorities::Type mRequest; TypedComplexArgument> mComplex_StreamPriorities; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command CaptureSnapshot */ class CameraAvStreamManagementCaptureSnapshot : public ClusterCommand { public: CameraAvStreamManagementCaptureSnapshot() : ClusterCommand("capture-snapshot") , mComplex_RequestedResolution(&mRequest.requestedResolution) { #if MTR_ENABLE_PROVISIONAL AddArgument("SnapshotStreamID", 0, UINT16_MAX, &mRequest.snapshotStreamID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("RequestedResolution", &mComplex_RequestedResolution); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::CaptureSnapshot::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRCameraAVStreamManagementClusterCaptureSnapshotParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.snapshotStreamID = [NSNumber numberWithUnsignedShort:mRequest.snapshotStreamID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.requestedResolution = [MTRCameraAVStreamManagementClusterVideoResolutionStruct new]; params.requestedResolution.width = [NSNumber numberWithUnsignedShort:mRequest.requestedResolution.width]; params.requestedResolution.height = [NSNumber numberWithUnsignedShort:mRequest.requestedResolution.height]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster captureSnapshotWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::CameraAvStreamManagement::Commands::CaptureSnapshot::Type mRequest; TypedComplexArgument mComplex_RequestedResolution; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetViewport */ class CameraAvStreamManagementSetViewport : public ClusterCommand { public: CameraAvStreamManagementSetViewport() : ClusterCommand("set-viewport") , mComplex_Viewport(&mRequest.viewport) { #if MTR_ENABLE_PROVISIONAL AddArgument("Viewport", &mComplex_Viewport); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetViewport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRCameraAVStreamManagementClusterSetViewportParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.viewport = [MTRCameraAVStreamManagementClusterViewportStruct new]; params.viewport.x1 = [NSNumber numberWithUnsignedShort:mRequest.viewport.x1]; params.viewport.y1 = [NSNumber numberWithUnsignedShort:mRequest.viewport.y1]; params.viewport.x2 = [NSNumber numberWithUnsignedShort:mRequest.viewport.x2]; params.viewport.y2 = [NSNumber numberWithUnsignedShort:mRequest.viewport.y2]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setViewportWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::CameraAvStreamManagement::Commands::SetViewport::Type mRequest; TypedComplexArgument mComplex_Viewport; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetImageRotation */ class CameraAvStreamManagementSetImageRotation : public ClusterCommand { public: CameraAvStreamManagementSetImageRotation() : ClusterCommand("set-image-rotation") { #if MTR_ENABLE_PROVISIONAL AddArgument("Angle", 0, UINT16_MAX, &mRequest.angle); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageRotation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRCameraAVStreamManagementClusterSetImageRotationParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.angle = [NSNumber numberWithUnsignedShort:mRequest.angle]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setImageRotationWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageRotation::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetImageFlipHorizontal */ class CameraAvStreamManagementSetImageFlipHorizontal : public ClusterCommand { public: CameraAvStreamManagementSetImageFlipHorizontal() : ClusterCommand("set-image-flip-horizontal") { #if MTR_ENABLE_PROVISIONAL AddArgument("Enabled", 0, 1, &mRequest.enabled); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipHorizontal::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRCameraAVStreamManagementClusterSetImageFlipHorizontalParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.enabled = [NSNumber numberWithBool:mRequest.enabled]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setImageFlipHorizontalWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipHorizontal::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command SetImageFlipVertical */ class CameraAvStreamManagementSetImageFlipVertical : public ClusterCommand { public: CameraAvStreamManagementSetImageFlipVertical() : ClusterCommand("set-image-flip-vertical") { #if MTR_ENABLE_PROVISIONAL AddArgument("Enabled", 0, 1, &mRequest.enabled); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId commandId = chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipVertical::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRCameraAVStreamManagementClusterSetImageFlipVerticalParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.enabled = [NSNumber numberWithBool:mRequest.enabled]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster setImageFlipVerticalWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::CameraAvStreamManagement::Commands::SetImageFlipVertical::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MaxConcurrentVideoEncoders */ class ReadCameraAvStreamManagementMaxConcurrentVideoEncoders : public ReadAttribute { public: ReadCameraAvStreamManagementMaxConcurrentVideoEncoders() : ReadAttribute("max-concurrent-video-encoders") { } ~ReadCameraAvStreamManagementMaxConcurrentVideoEncoders() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MaxConcurrentVideoEncoders::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxConcurrentVideoEncodersWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MaxConcurrentVideoEncoders response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement MaxConcurrentVideoEncoders read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementMaxConcurrentVideoEncoders : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementMaxConcurrentVideoEncoders() : SubscribeAttribute("max-concurrent-video-encoders") { } ~SubscribeAttributeCameraAvStreamManagementMaxConcurrentVideoEncoders() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MaxConcurrentVideoEncoders::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxConcurrentVideoEncodersWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MaxConcurrentVideoEncoders response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MaxEncodedPixelRate */ class ReadCameraAvStreamManagementMaxEncodedPixelRate : public ReadAttribute { public: ReadCameraAvStreamManagementMaxEncodedPixelRate() : ReadAttribute("max-encoded-pixel-rate") { } ~ReadCameraAvStreamManagementMaxEncodedPixelRate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MaxEncodedPixelRate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxEncodedPixelRateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MaxEncodedPixelRate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement MaxEncodedPixelRate read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementMaxEncodedPixelRate : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementMaxEncodedPixelRate() : SubscribeAttribute("max-encoded-pixel-rate") { } ~SubscribeAttributeCameraAvStreamManagementMaxEncodedPixelRate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MaxEncodedPixelRate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxEncodedPixelRateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MaxEncodedPixelRate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute VideoSensorParams */ class ReadCameraAvStreamManagementVideoSensorParams : public ReadAttribute { public: ReadCameraAvStreamManagementVideoSensorParams() : ReadAttribute("video-sensor-params") { } ~ReadCameraAvStreamManagementVideoSensorParams() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::VideoSensorParams::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeVideoSensorParamsWithCompletion:^(MTRCameraAVStreamManagementClusterVideoSensorParamsStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.VideoSensorParams response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement VideoSensorParams read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementVideoSensorParams : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementVideoSensorParams() : SubscribeAttribute("video-sensor-params") { } ~SubscribeAttributeCameraAvStreamManagementVideoSensorParams() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::VideoSensorParams::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeVideoSensorParamsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRCameraAVStreamManagementClusterVideoSensorParamsStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.VideoSensorParams response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NightVisionCapable */ class ReadCameraAvStreamManagementNightVisionCapable : public ReadAttribute { public: ReadCameraAvStreamManagementNightVisionCapable() : ReadAttribute("night-vision-capable") { } ~ReadCameraAvStreamManagementNightVisionCapable() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::NightVisionCapable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNightVisionCapableWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.NightVisionCapable response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement NightVisionCapable read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementNightVisionCapable : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementNightVisionCapable() : SubscribeAttribute("night-vision-capable") { } ~SubscribeAttributeCameraAvStreamManagementNightVisionCapable() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::NightVisionCapable::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNightVisionCapableWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.NightVisionCapable response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MinViewport */ class ReadCameraAvStreamManagementMinViewport : public ReadAttribute { public: ReadCameraAvStreamManagementMinViewport() : ReadAttribute("min-viewport") { } ~ReadCameraAvStreamManagementMinViewport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MinViewport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMinViewportWithCompletion:^(MTRCameraAVStreamManagementClusterVideoResolutionStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MinViewport response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement MinViewport read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementMinViewport : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementMinViewport() : SubscribeAttribute("min-viewport") { } ~SubscribeAttributeCameraAvStreamManagementMinViewport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MinViewport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMinViewportWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRCameraAVStreamManagementClusterVideoResolutionStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MinViewport response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute RateDistortionTradeOffPoints */ class ReadCameraAvStreamManagementRateDistortionTradeOffPoints : public ReadAttribute { public: ReadCameraAvStreamManagementRateDistortionTradeOffPoints() : ReadAttribute("rate-distortion-trade-off-points") { } ~ReadCameraAvStreamManagementRateDistortionTradeOffPoints() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::RateDistortionTradeOffPoints::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRateDistortionTradeOffPointsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.RateDistortionTradeOffPoints response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement RateDistortionTradeOffPoints read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementRateDistortionTradeOffPoints : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementRateDistortionTradeOffPoints() : SubscribeAttribute("rate-distortion-trade-off-points") { } ~SubscribeAttributeCameraAvStreamManagementRateDistortionTradeOffPoints() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::RateDistortionTradeOffPoints::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRateDistortionTradeOffPointsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.RateDistortionTradeOffPoints response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MaxPreRollBufferSize */ class ReadCameraAvStreamManagementMaxPreRollBufferSize : public ReadAttribute { public: ReadCameraAvStreamManagementMaxPreRollBufferSize() : ReadAttribute("max-pre-roll-buffer-size") { } ~ReadCameraAvStreamManagementMaxPreRollBufferSize() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MaxPreRollBufferSize::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxPreRollBufferSizeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MaxPreRollBufferSize response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement MaxPreRollBufferSize read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementMaxPreRollBufferSize : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementMaxPreRollBufferSize() : SubscribeAttribute("max-pre-roll-buffer-size") { } ~SubscribeAttributeCameraAvStreamManagementMaxPreRollBufferSize() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MaxPreRollBufferSize::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxPreRollBufferSizeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MaxPreRollBufferSize response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MicrophoneCapabilities */ class ReadCameraAvStreamManagementMicrophoneCapabilities : public ReadAttribute { public: ReadCameraAvStreamManagementMicrophoneCapabilities() : ReadAttribute("microphone-capabilities") { } ~ReadCameraAvStreamManagementMicrophoneCapabilities() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneCapabilities::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMicrophoneCapabilitiesWithCompletion:^(MTRCameraAVStreamManagementClusterAudioCapabilitiesStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MicrophoneCapabilities response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement MicrophoneCapabilities read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementMicrophoneCapabilities : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementMicrophoneCapabilities() : SubscribeAttribute("microphone-capabilities") { } ~SubscribeAttributeCameraAvStreamManagementMicrophoneCapabilities() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneCapabilities::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMicrophoneCapabilitiesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRCameraAVStreamManagementClusterAudioCapabilitiesStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MicrophoneCapabilities response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SpeakerCapabilities */ class ReadCameraAvStreamManagementSpeakerCapabilities : public ReadAttribute { public: ReadCameraAvStreamManagementSpeakerCapabilities() : ReadAttribute("speaker-capabilities") { } ~ReadCameraAvStreamManagementSpeakerCapabilities() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerCapabilities::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSpeakerCapabilitiesWithCompletion:^(MTRCameraAVStreamManagementClusterAudioCapabilitiesStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.SpeakerCapabilities response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement SpeakerCapabilities read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementSpeakerCapabilities : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementSpeakerCapabilities() : SubscribeAttribute("speaker-capabilities") { } ~SubscribeAttributeCameraAvStreamManagementSpeakerCapabilities() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerCapabilities::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSpeakerCapabilitiesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRCameraAVStreamManagementClusterAudioCapabilitiesStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.SpeakerCapabilities response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute TwoWayTalkSupport */ class ReadCameraAvStreamManagementTwoWayTalkSupport : public ReadAttribute { public: ReadCameraAvStreamManagementTwoWayTalkSupport() : ReadAttribute("two-way-talk-support") { } ~ReadCameraAvStreamManagementTwoWayTalkSupport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::TwoWayTalkSupport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTwoWayTalkSupportWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.TwoWayTalkSupport response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement TwoWayTalkSupport read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementTwoWayTalkSupport : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementTwoWayTalkSupport() : SubscribeAttribute("two-way-talk-support") { } ~SubscribeAttributeCameraAvStreamManagementTwoWayTalkSupport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::TwoWayTalkSupport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTwoWayTalkSupportWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.TwoWayTalkSupport response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedSnapshotParams */ class ReadCameraAvStreamManagementSupportedSnapshotParams : public ReadAttribute { public: ReadCameraAvStreamManagementSupportedSnapshotParams() : ReadAttribute("supported-snapshot-params") { } ~ReadCameraAvStreamManagementSupportedSnapshotParams() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SupportedSnapshotParams::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedSnapshotParamsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.SupportedSnapshotParams response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement SupportedSnapshotParams read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementSupportedSnapshotParams : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementSupportedSnapshotParams() : SubscribeAttribute("supported-snapshot-params") { } ~SubscribeAttributeCameraAvStreamManagementSupportedSnapshotParams() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SupportedSnapshotParams::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedSnapshotParamsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.SupportedSnapshotParams response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MaxNetworkBandwidth */ class ReadCameraAvStreamManagementMaxNetworkBandwidth : public ReadAttribute { public: ReadCameraAvStreamManagementMaxNetworkBandwidth() : ReadAttribute("max-network-bandwidth") { } ~ReadCameraAvStreamManagementMaxNetworkBandwidth() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MaxNetworkBandwidth::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMaxNetworkBandwidthWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MaxNetworkBandwidth response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement MaxNetworkBandwidth read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementMaxNetworkBandwidth : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementMaxNetworkBandwidth() : SubscribeAttribute("max-network-bandwidth") { } ~SubscribeAttributeCameraAvStreamManagementMaxNetworkBandwidth() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MaxNetworkBandwidth::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMaxNetworkBandwidthWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MaxNetworkBandwidth response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentFrameRate */ class ReadCameraAvStreamManagementCurrentFrameRate : public ReadAttribute { public: ReadCameraAvStreamManagementCurrentFrameRate() : ReadAttribute("current-frame-rate") { } ~ReadCameraAvStreamManagementCurrentFrameRate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::CurrentFrameRate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentFrameRateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.CurrentFrameRate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement CurrentFrameRate read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementCurrentFrameRate : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementCurrentFrameRate() : SubscribeAttribute("current-frame-rate") { } ~SubscribeAttributeCameraAvStreamManagementCurrentFrameRate() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::CurrentFrameRate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentFrameRateWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.CurrentFrameRate response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute HDRModeEnabled */ class ReadCameraAvStreamManagementHDRModeEnabled : public ReadAttribute { public: ReadCameraAvStreamManagementHDRModeEnabled() : ReadAttribute("hdrmode-enabled") { } ~ReadCameraAvStreamManagementHDRModeEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::HDRModeEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeHDRModeEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.HDRModeEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement HDRModeEnabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementHDRModeEnabled : public WriteAttribute { public: WriteCameraAvStreamManagementHDRModeEnabled() : WriteAttribute("hdrmode-enabled") { AddArgument("attr-name", "hdrmode-enabled"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementHDRModeEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::HDRModeEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeHDRModeEnabledWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement HDRModeEnabled write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeCameraAvStreamManagementHDRModeEnabled : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementHDRModeEnabled() : SubscribeAttribute("hdrmode-enabled") { } ~SubscribeAttributeCameraAvStreamManagementHDRModeEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::HDRModeEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeHDRModeEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.HDRModeEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentVideoCodecs */ class ReadCameraAvStreamManagementCurrentVideoCodecs : public ReadAttribute { public: ReadCameraAvStreamManagementCurrentVideoCodecs() : ReadAttribute("current-video-codecs") { } ~ReadCameraAvStreamManagementCurrentVideoCodecs() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::CurrentVideoCodecs::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentVideoCodecsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.CurrentVideoCodecs response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement CurrentVideoCodecs read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementCurrentVideoCodecs : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementCurrentVideoCodecs() : SubscribeAttribute("current-video-codecs") { } ~SubscribeAttributeCameraAvStreamManagementCurrentVideoCodecs() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::CurrentVideoCodecs::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentVideoCodecsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.CurrentVideoCodecs response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentSnapshotConfig */ class ReadCameraAvStreamManagementCurrentSnapshotConfig : public ReadAttribute { public: ReadCameraAvStreamManagementCurrentSnapshotConfig() : ReadAttribute("current-snapshot-config") { } ~ReadCameraAvStreamManagementCurrentSnapshotConfig() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::CurrentSnapshotConfig::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentSnapshotConfigWithCompletion:^(MTRCameraAVStreamManagementClusterSnapshotParamsStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.CurrentSnapshotConfig response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement CurrentSnapshotConfig read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementCurrentSnapshotConfig : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementCurrentSnapshotConfig() : SubscribeAttribute("current-snapshot-config") { } ~SubscribeAttributeCameraAvStreamManagementCurrentSnapshotConfig() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::CurrentSnapshotConfig::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentSnapshotConfigWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRCameraAVStreamManagementClusterSnapshotParamsStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.CurrentSnapshotConfig response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FabricsUsingCamera */ class ReadCameraAvStreamManagementFabricsUsingCamera : public ReadAttribute { public: ReadCameraAvStreamManagementFabricsUsingCamera() : ReadAttribute("fabrics-using-camera") { } ~ReadCameraAvStreamManagementFabricsUsingCamera() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::FabricsUsingCamera::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFabricsUsingCameraWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.FabricsUsingCamera response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement FabricsUsingCamera read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementFabricsUsingCamera : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementFabricsUsingCamera() : SubscribeAttribute("fabrics-using-camera") { } ~SubscribeAttributeCameraAvStreamManagementFabricsUsingCamera() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::FabricsUsingCamera::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFabricsUsingCameraWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.FabricsUsingCamera response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AllocatedVideoStreams */ class ReadCameraAvStreamManagementAllocatedVideoStreams : public ReadAttribute { public: ReadCameraAvStreamManagementAllocatedVideoStreams() : ReadAttribute("allocated-video-streams") { } ~ReadCameraAvStreamManagementAllocatedVideoStreams() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AllocatedVideoStreams::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAllocatedVideoStreamsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.AllocatedVideoStreams response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement AllocatedVideoStreams read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementAllocatedVideoStreams : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementAllocatedVideoStreams() : SubscribeAttribute("allocated-video-streams") { } ~SubscribeAttributeCameraAvStreamManagementAllocatedVideoStreams() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AllocatedVideoStreams::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAllocatedVideoStreamsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.AllocatedVideoStreams response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AllocatedAudioStreams */ class ReadCameraAvStreamManagementAllocatedAudioStreams : public ReadAttribute { public: ReadCameraAvStreamManagementAllocatedAudioStreams() : ReadAttribute("allocated-audio-streams") { } ~ReadCameraAvStreamManagementAllocatedAudioStreams() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AllocatedAudioStreams::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAllocatedAudioStreamsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.AllocatedAudioStreams response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement AllocatedAudioStreams read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementAllocatedAudioStreams : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementAllocatedAudioStreams() : SubscribeAttribute("allocated-audio-streams") { } ~SubscribeAttributeCameraAvStreamManagementAllocatedAudioStreams() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AllocatedAudioStreams::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAllocatedAudioStreamsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.AllocatedAudioStreams response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AllocatedSnapshotStreams */ class ReadCameraAvStreamManagementAllocatedSnapshotStreams : public ReadAttribute { public: ReadCameraAvStreamManagementAllocatedSnapshotStreams() : ReadAttribute("allocated-snapshot-streams") { } ~ReadCameraAvStreamManagementAllocatedSnapshotStreams() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AllocatedSnapshotStreams::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAllocatedSnapshotStreamsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.AllocatedSnapshotStreams response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement AllocatedSnapshotStreams read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementAllocatedSnapshotStreams : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementAllocatedSnapshotStreams() : SubscribeAttribute("allocated-snapshot-streams") { } ~SubscribeAttributeCameraAvStreamManagementAllocatedSnapshotStreams() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AllocatedSnapshotStreams::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAllocatedSnapshotStreamsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.AllocatedSnapshotStreams response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute RankedVideoStreamPrioritiesList */ class ReadCameraAvStreamManagementRankedVideoStreamPrioritiesList : public ReadAttribute { public: ReadCameraAvStreamManagementRankedVideoStreamPrioritiesList() : ReadAttribute("ranked-video-stream-priorities-list") { } ~ReadCameraAvStreamManagementRankedVideoStreamPrioritiesList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::RankedVideoStreamPrioritiesList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRankedVideoStreamPrioritiesListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.RankedVideoStreamPrioritiesList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement RankedVideoStreamPrioritiesList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementRankedVideoStreamPrioritiesList : public WriteAttribute { public: WriteCameraAvStreamManagementRankedVideoStreamPrioritiesList() : WriteAttribute("ranked-video-stream-priorities-list") , mComplex(&mValue) { AddArgument("attr-name", "ranked-video-stream-priorities-list"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementRankedVideoStreamPrioritiesList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::RankedVideoStreamPrioritiesList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSArray * _Nonnull value; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { NSNumber * newElement_0; newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; [array_0 addObject:newElement_0]; } value = array_0; } [cluster writeAttributeRankedVideoStreamPrioritiesListWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement RankedVideoStreamPrioritiesList write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::List mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeCameraAvStreamManagementRankedVideoStreamPrioritiesList : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementRankedVideoStreamPrioritiesList() : SubscribeAttribute("ranked-video-stream-priorities-list") { } ~SubscribeAttributeCameraAvStreamManagementRankedVideoStreamPrioritiesList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::RankedVideoStreamPrioritiesList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRankedVideoStreamPrioritiesListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.RankedVideoStreamPrioritiesList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SoftRecordingPrivacyModeEnabled */ class ReadCameraAvStreamManagementSoftRecordingPrivacyModeEnabled : public ReadAttribute { public: ReadCameraAvStreamManagementSoftRecordingPrivacyModeEnabled() : ReadAttribute("soft-recording-privacy-mode-enabled") { } ~ReadCameraAvStreamManagementSoftRecordingPrivacyModeEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SoftRecordingPrivacyModeEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSoftRecordingPrivacyModeEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.SoftRecordingPrivacyModeEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement SoftRecordingPrivacyModeEnabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementSoftRecordingPrivacyModeEnabled : public WriteAttribute { public: WriteCameraAvStreamManagementSoftRecordingPrivacyModeEnabled() : WriteAttribute("soft-recording-privacy-mode-enabled") { AddArgument("attr-name", "soft-recording-privacy-mode-enabled"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementSoftRecordingPrivacyModeEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SoftRecordingPrivacyModeEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeSoftRecordingPrivacyModeEnabledWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement SoftRecordingPrivacyModeEnabled write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeCameraAvStreamManagementSoftRecordingPrivacyModeEnabled : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementSoftRecordingPrivacyModeEnabled() : SubscribeAttribute("soft-recording-privacy-mode-enabled") { } ~SubscribeAttributeCameraAvStreamManagementSoftRecordingPrivacyModeEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SoftRecordingPrivacyModeEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSoftRecordingPrivacyModeEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.SoftRecordingPrivacyModeEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SoftLivestreamPrivacyModeEnabled */ class ReadCameraAvStreamManagementSoftLivestreamPrivacyModeEnabled : public ReadAttribute { public: ReadCameraAvStreamManagementSoftLivestreamPrivacyModeEnabled() : ReadAttribute("soft-livestream-privacy-mode-enabled") { } ~ReadCameraAvStreamManagementSoftLivestreamPrivacyModeEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SoftLivestreamPrivacyModeEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSoftLivestreamPrivacyModeEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.SoftLivestreamPrivacyModeEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement SoftLivestreamPrivacyModeEnabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementSoftLivestreamPrivacyModeEnabled : public WriteAttribute { public: WriteCameraAvStreamManagementSoftLivestreamPrivacyModeEnabled() : WriteAttribute("soft-livestream-privacy-mode-enabled") { AddArgument("attr-name", "soft-livestream-privacy-mode-enabled"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementSoftLivestreamPrivacyModeEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SoftLivestreamPrivacyModeEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeSoftLivestreamPrivacyModeEnabledWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement SoftLivestreamPrivacyModeEnabled write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeCameraAvStreamManagementSoftLivestreamPrivacyModeEnabled : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementSoftLivestreamPrivacyModeEnabled() : SubscribeAttribute("soft-livestream-privacy-mode-enabled") { } ~SubscribeAttributeCameraAvStreamManagementSoftLivestreamPrivacyModeEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SoftLivestreamPrivacyModeEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSoftLivestreamPrivacyModeEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.SoftLivestreamPrivacyModeEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute HardPrivacyModeOn */ class ReadCameraAvStreamManagementHardPrivacyModeOn : public ReadAttribute { public: ReadCameraAvStreamManagementHardPrivacyModeOn() : ReadAttribute("hard-privacy-mode-on") { } ~ReadCameraAvStreamManagementHardPrivacyModeOn() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::HardPrivacyModeOn::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeHardPrivacyModeOnWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.HardPrivacyModeOn response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement HardPrivacyModeOn read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementHardPrivacyModeOn : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementHardPrivacyModeOn() : SubscribeAttribute("hard-privacy-mode-on") { } ~SubscribeAttributeCameraAvStreamManagementHardPrivacyModeOn() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::HardPrivacyModeOn::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeHardPrivacyModeOnWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.HardPrivacyModeOn response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NightVision */ class ReadCameraAvStreamManagementNightVision : public ReadAttribute { public: ReadCameraAvStreamManagementNightVision() : ReadAttribute("night-vision") { } ~ReadCameraAvStreamManagementNightVision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::NightVision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNightVisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.NightVision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement NightVision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementNightVision : public WriteAttribute { public: WriteCameraAvStreamManagementNightVision() : WriteAttribute("night-vision") { AddArgument("attr-name", "night-vision"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementNightVision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::NightVision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeNightVisionWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement NightVision write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeCameraAvStreamManagementNightVision : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementNightVision() : SubscribeAttribute("night-vision") { } ~SubscribeAttributeCameraAvStreamManagementNightVision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::NightVision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNightVisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.NightVision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NightVisionIllum */ class ReadCameraAvStreamManagementNightVisionIllum : public ReadAttribute { public: ReadCameraAvStreamManagementNightVisionIllum() : ReadAttribute("night-vision-illum") { } ~ReadCameraAvStreamManagementNightVisionIllum() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::NightVisionIllum::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNightVisionIllumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.NightVisionIllum response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement NightVisionIllum read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementNightVisionIllum : public WriteAttribute { public: WriteCameraAvStreamManagementNightVisionIllum() : WriteAttribute("night-vision-illum") { AddArgument("attr-name", "night-vision-illum"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementNightVisionIllum() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::NightVisionIllum::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeNightVisionIllumWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement NightVisionIllum write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeCameraAvStreamManagementNightVisionIllum : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementNightVisionIllum() : SubscribeAttribute("night-vision-illum") { } ~SubscribeAttributeCameraAvStreamManagementNightVisionIllum() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::NightVisionIllum::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNightVisionIllumWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.NightVisionIllum response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AWBEnabled */ class ReadCameraAvStreamManagementAWBEnabled : public ReadAttribute { public: ReadCameraAvStreamManagementAWBEnabled() : ReadAttribute("awbenabled") { } ~ReadCameraAvStreamManagementAWBEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AWBEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAWBEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.AWBEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement AWBEnabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementAWBEnabled : public WriteAttribute { public: WriteCameraAvStreamManagementAWBEnabled() : WriteAttribute("awbenabled") { AddArgument("attr-name", "awbenabled"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementAWBEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AWBEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeAWBEnabledWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement AWBEnabled write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeCameraAvStreamManagementAWBEnabled : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementAWBEnabled() : SubscribeAttribute("awbenabled") { } ~SubscribeAttributeCameraAvStreamManagementAWBEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AWBEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAWBEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.AWBEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AutoShutterSpeedEnabled */ class ReadCameraAvStreamManagementAutoShutterSpeedEnabled : public ReadAttribute { public: ReadCameraAvStreamManagementAutoShutterSpeedEnabled() : ReadAttribute("auto-shutter-speed-enabled") { } ~ReadCameraAvStreamManagementAutoShutterSpeedEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AutoShutterSpeedEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAutoShutterSpeedEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.AutoShutterSpeedEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement AutoShutterSpeedEnabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementAutoShutterSpeedEnabled : public WriteAttribute { public: WriteCameraAvStreamManagementAutoShutterSpeedEnabled() : WriteAttribute("auto-shutter-speed-enabled") { AddArgument("attr-name", "auto-shutter-speed-enabled"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementAutoShutterSpeedEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AutoShutterSpeedEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeAutoShutterSpeedEnabledWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement AutoShutterSpeedEnabled write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeCameraAvStreamManagementAutoShutterSpeedEnabled : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementAutoShutterSpeedEnabled() : SubscribeAttribute("auto-shutter-speed-enabled") { } ~SubscribeAttributeCameraAvStreamManagementAutoShutterSpeedEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AutoShutterSpeedEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAutoShutterSpeedEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.AutoShutterSpeedEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AutoISOEnabled */ class ReadCameraAvStreamManagementAutoISOEnabled : public ReadAttribute { public: ReadCameraAvStreamManagementAutoISOEnabled() : ReadAttribute("auto-isoenabled") { } ~ReadCameraAvStreamManagementAutoISOEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AutoISOEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAutoISOEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.AutoISOEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement AutoISOEnabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementAutoISOEnabled : public WriteAttribute { public: WriteCameraAvStreamManagementAutoISOEnabled() : WriteAttribute("auto-isoenabled") { AddArgument("attr-name", "auto-isoenabled"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementAutoISOEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AutoISOEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeAutoISOEnabledWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement AutoISOEnabled write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeCameraAvStreamManagementAutoISOEnabled : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementAutoISOEnabled() : SubscribeAttribute("auto-isoenabled") { } ~SubscribeAttributeCameraAvStreamManagementAutoISOEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AutoISOEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAutoISOEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.AutoISOEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Viewport */ class ReadCameraAvStreamManagementViewport : public ReadAttribute { public: ReadCameraAvStreamManagementViewport() : ReadAttribute("viewport") { } ~ReadCameraAvStreamManagementViewport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::Viewport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeViewportWithCompletion:^(MTRCameraAVStreamManagementClusterViewportStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.Viewport response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement Viewport read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementViewport : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementViewport() : SubscribeAttribute("viewport") { } ~SubscribeAttributeCameraAvStreamManagementViewport() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::Viewport::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeViewportWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRCameraAVStreamManagementClusterViewportStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.Viewport response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SpeakerMuted */ class ReadCameraAvStreamManagementSpeakerMuted : public ReadAttribute { public: ReadCameraAvStreamManagementSpeakerMuted() : ReadAttribute("speaker-muted") { } ~ReadCameraAvStreamManagementSpeakerMuted() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMuted::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSpeakerMutedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.SpeakerMuted response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement SpeakerMuted read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementSpeakerMuted : public WriteAttribute { public: WriteCameraAvStreamManagementSpeakerMuted() : WriteAttribute("speaker-muted") { AddArgument("attr-name", "speaker-muted"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementSpeakerMuted() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMuted::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeSpeakerMutedWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement SpeakerMuted write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeCameraAvStreamManagementSpeakerMuted : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementSpeakerMuted() : SubscribeAttribute("speaker-muted") { } ~SubscribeAttributeCameraAvStreamManagementSpeakerMuted() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMuted::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSpeakerMutedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.SpeakerMuted response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SpeakerVolumeLevel */ class ReadCameraAvStreamManagementSpeakerVolumeLevel : public ReadAttribute { public: ReadCameraAvStreamManagementSpeakerVolumeLevel() : ReadAttribute("speaker-volume-level") { } ~ReadCameraAvStreamManagementSpeakerVolumeLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerVolumeLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSpeakerVolumeLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.SpeakerVolumeLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement SpeakerVolumeLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementSpeakerVolumeLevel : public WriteAttribute { public: WriteCameraAvStreamManagementSpeakerVolumeLevel() : WriteAttribute("speaker-volume-level") { AddArgument("attr-name", "speaker-volume-level"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementSpeakerVolumeLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerVolumeLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeSpeakerVolumeLevelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement SpeakerVolumeLevel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeCameraAvStreamManagementSpeakerVolumeLevel : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementSpeakerVolumeLevel() : SubscribeAttribute("speaker-volume-level") { } ~SubscribeAttributeCameraAvStreamManagementSpeakerVolumeLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerVolumeLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSpeakerVolumeLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.SpeakerVolumeLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SpeakerMaxLevel */ class ReadCameraAvStreamManagementSpeakerMaxLevel : public ReadAttribute { public: ReadCameraAvStreamManagementSpeakerMaxLevel() : ReadAttribute("speaker-max-level") { } ~ReadCameraAvStreamManagementSpeakerMaxLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMaxLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSpeakerMaxLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.SpeakerMaxLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement SpeakerMaxLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementSpeakerMaxLevel : public WriteAttribute { public: WriteCameraAvStreamManagementSpeakerMaxLevel() : WriteAttribute("speaker-max-level") { AddArgument("attr-name", "speaker-max-level"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementSpeakerMaxLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMaxLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeSpeakerMaxLevelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement SpeakerMaxLevel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeCameraAvStreamManagementSpeakerMaxLevel : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementSpeakerMaxLevel() : SubscribeAttribute("speaker-max-level") { } ~SubscribeAttributeCameraAvStreamManagementSpeakerMaxLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMaxLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSpeakerMaxLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.SpeakerMaxLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SpeakerMinLevel */ class ReadCameraAvStreamManagementSpeakerMinLevel : public ReadAttribute { public: ReadCameraAvStreamManagementSpeakerMinLevel() : ReadAttribute("speaker-min-level") { } ~ReadCameraAvStreamManagementSpeakerMinLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMinLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSpeakerMinLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.SpeakerMinLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement SpeakerMinLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementSpeakerMinLevel : public WriteAttribute { public: WriteCameraAvStreamManagementSpeakerMinLevel() : WriteAttribute("speaker-min-level") { AddArgument("attr-name", "speaker-min-level"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementSpeakerMinLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMinLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeSpeakerMinLevelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement SpeakerMinLevel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeCameraAvStreamManagementSpeakerMinLevel : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementSpeakerMinLevel() : SubscribeAttribute("speaker-min-level") { } ~SubscribeAttributeCameraAvStreamManagementSpeakerMinLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::SpeakerMinLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSpeakerMinLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.SpeakerMinLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MicrophoneMuted */ class ReadCameraAvStreamManagementMicrophoneMuted : public ReadAttribute { public: ReadCameraAvStreamManagementMicrophoneMuted() : ReadAttribute("microphone-muted") { } ~ReadCameraAvStreamManagementMicrophoneMuted() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneMuted::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMicrophoneMutedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MicrophoneMuted response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement MicrophoneMuted read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementMicrophoneMuted : public WriteAttribute { public: WriteCameraAvStreamManagementMicrophoneMuted() : WriteAttribute("microphone-muted") { AddArgument("attr-name", "microphone-muted"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementMicrophoneMuted() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneMuted::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeMicrophoneMutedWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement MicrophoneMuted write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeCameraAvStreamManagementMicrophoneMuted : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementMicrophoneMuted() : SubscribeAttribute("microphone-muted") { } ~SubscribeAttributeCameraAvStreamManagementMicrophoneMuted() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneMuted::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMicrophoneMutedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MicrophoneMuted response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MicrophoneVolumeLevel */ class ReadCameraAvStreamManagementMicrophoneVolumeLevel : public ReadAttribute { public: ReadCameraAvStreamManagementMicrophoneVolumeLevel() : ReadAttribute("microphone-volume-level") { } ~ReadCameraAvStreamManagementMicrophoneVolumeLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneVolumeLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMicrophoneVolumeLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MicrophoneVolumeLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement MicrophoneVolumeLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementMicrophoneVolumeLevel : public WriteAttribute { public: WriteCameraAvStreamManagementMicrophoneVolumeLevel() : WriteAttribute("microphone-volume-level") { AddArgument("attr-name", "microphone-volume-level"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementMicrophoneVolumeLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneVolumeLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeMicrophoneVolumeLevelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement MicrophoneVolumeLevel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeCameraAvStreamManagementMicrophoneVolumeLevel : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementMicrophoneVolumeLevel() : SubscribeAttribute("microphone-volume-level") { } ~SubscribeAttributeCameraAvStreamManagementMicrophoneVolumeLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneVolumeLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMicrophoneVolumeLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MicrophoneVolumeLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MicrophoneMaxLevel */ class ReadCameraAvStreamManagementMicrophoneMaxLevel : public ReadAttribute { public: ReadCameraAvStreamManagementMicrophoneMaxLevel() : ReadAttribute("microphone-max-level") { } ~ReadCameraAvStreamManagementMicrophoneMaxLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneMaxLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMicrophoneMaxLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MicrophoneMaxLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement MicrophoneMaxLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementMicrophoneMaxLevel : public WriteAttribute { public: WriteCameraAvStreamManagementMicrophoneMaxLevel() : WriteAttribute("microphone-max-level") { AddArgument("attr-name", "microphone-max-level"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementMicrophoneMaxLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneMaxLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeMicrophoneMaxLevelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement MicrophoneMaxLevel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeCameraAvStreamManagementMicrophoneMaxLevel : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementMicrophoneMaxLevel() : SubscribeAttribute("microphone-max-level") { } ~SubscribeAttributeCameraAvStreamManagementMicrophoneMaxLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneMaxLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMicrophoneMaxLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MicrophoneMaxLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MicrophoneMinLevel */ class ReadCameraAvStreamManagementMicrophoneMinLevel : public ReadAttribute { public: ReadCameraAvStreamManagementMicrophoneMinLevel() : ReadAttribute("microphone-min-level") { } ~ReadCameraAvStreamManagementMicrophoneMinLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneMinLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMicrophoneMinLevelWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MicrophoneMinLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement MicrophoneMinLevel read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementMicrophoneMinLevel : public WriteAttribute { public: WriteCameraAvStreamManagementMicrophoneMinLevel() : WriteAttribute("microphone-min-level") { AddArgument("attr-name", "microphone-min-level"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementMicrophoneMinLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneMinLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeMicrophoneMinLevelWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement MicrophoneMinLevel write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeCameraAvStreamManagementMicrophoneMinLevel : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementMicrophoneMinLevel() : SubscribeAttribute("microphone-min-level") { } ~SubscribeAttributeCameraAvStreamManagementMicrophoneMinLevel() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneMinLevel::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMicrophoneMinLevelWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MicrophoneMinLevel response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute MicrophoneAGCEnabled */ class ReadCameraAvStreamManagementMicrophoneAGCEnabled : public ReadAttribute { public: ReadCameraAvStreamManagementMicrophoneAGCEnabled() : ReadAttribute("microphone-agcenabled") { } ~ReadCameraAvStreamManagementMicrophoneAGCEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneAGCEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMicrophoneAGCEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MicrophoneAGCEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement MicrophoneAGCEnabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementMicrophoneAGCEnabled : public WriteAttribute { public: WriteCameraAvStreamManagementMicrophoneAGCEnabled() : WriteAttribute("microphone-agcenabled") { AddArgument("attr-name", "microphone-agcenabled"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementMicrophoneAGCEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneAGCEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeMicrophoneAGCEnabledWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement MicrophoneAGCEnabled write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeCameraAvStreamManagementMicrophoneAGCEnabled : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementMicrophoneAGCEnabled() : SubscribeAttribute("microphone-agcenabled") { } ~SubscribeAttributeCameraAvStreamManagementMicrophoneAGCEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::MicrophoneAGCEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMicrophoneAGCEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.MicrophoneAGCEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ImageRotation */ class ReadCameraAvStreamManagementImageRotation : public ReadAttribute { public: ReadCameraAvStreamManagementImageRotation() : ReadAttribute("image-rotation") { } ~ReadCameraAvStreamManagementImageRotation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::ImageRotation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeImageRotationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.ImageRotation response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement ImageRotation read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementImageRotation : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementImageRotation() : SubscribeAttribute("image-rotation") { } ~SubscribeAttributeCameraAvStreamManagementImageRotation() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::ImageRotation::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeImageRotationWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.ImageRotation response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ImageFlipHorizontal */ class ReadCameraAvStreamManagementImageFlipHorizontal : public ReadAttribute { public: ReadCameraAvStreamManagementImageFlipHorizontal() : ReadAttribute("image-flip-horizontal") { } ~ReadCameraAvStreamManagementImageFlipHorizontal() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::ImageFlipHorizontal::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeImageFlipHorizontalWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.ImageFlipHorizontal response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement ImageFlipHorizontal read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementImageFlipHorizontal : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementImageFlipHorizontal() : SubscribeAttribute("image-flip-horizontal") { } ~SubscribeAttributeCameraAvStreamManagementImageFlipHorizontal() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::ImageFlipHorizontal::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeImageFlipHorizontalWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.ImageFlipHorizontal response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ImageFlipVertical */ class ReadCameraAvStreamManagementImageFlipVertical : public ReadAttribute { public: ReadCameraAvStreamManagementImageFlipVertical() : ReadAttribute("image-flip-vertical") { } ~ReadCameraAvStreamManagementImageFlipVertical() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::ImageFlipVertical::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeImageFlipVerticalWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.ImageFlipVertical response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement ImageFlipVertical read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementImageFlipVertical : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementImageFlipVertical() : SubscribeAttribute("image-flip-vertical") { } ~SubscribeAttributeCameraAvStreamManagementImageFlipVertical() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::ImageFlipVertical::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeImageFlipVerticalWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.ImageFlipVertical response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute LocalVideoRecordingEnabled */ class ReadCameraAvStreamManagementLocalVideoRecordingEnabled : public ReadAttribute { public: ReadCameraAvStreamManagementLocalVideoRecordingEnabled() : ReadAttribute("local-video-recording-enabled") { } ~ReadCameraAvStreamManagementLocalVideoRecordingEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::LocalVideoRecordingEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLocalVideoRecordingEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.LocalVideoRecordingEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement LocalVideoRecordingEnabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementLocalVideoRecordingEnabled : public WriteAttribute { public: WriteCameraAvStreamManagementLocalVideoRecordingEnabled() : WriteAttribute("local-video-recording-enabled") { AddArgument("attr-name", "local-video-recording-enabled"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementLocalVideoRecordingEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::LocalVideoRecordingEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeLocalVideoRecordingEnabledWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement LocalVideoRecordingEnabled write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeCameraAvStreamManagementLocalVideoRecordingEnabled : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementLocalVideoRecordingEnabled() : SubscribeAttribute("local-video-recording-enabled") { } ~SubscribeAttributeCameraAvStreamManagementLocalVideoRecordingEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::LocalVideoRecordingEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLocalVideoRecordingEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.LocalVideoRecordingEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute LocalSnapshotRecordingEnabled */ class ReadCameraAvStreamManagementLocalSnapshotRecordingEnabled : public ReadAttribute { public: ReadCameraAvStreamManagementLocalSnapshotRecordingEnabled() : ReadAttribute("local-snapshot-recording-enabled") { } ~ReadCameraAvStreamManagementLocalSnapshotRecordingEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::LocalSnapshotRecordingEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLocalSnapshotRecordingEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.LocalSnapshotRecordingEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement LocalSnapshotRecordingEnabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementLocalSnapshotRecordingEnabled : public WriteAttribute { public: WriteCameraAvStreamManagementLocalSnapshotRecordingEnabled() : WriteAttribute("local-snapshot-recording-enabled") { AddArgument("attr-name", "local-snapshot-recording-enabled"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementLocalSnapshotRecordingEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::LocalSnapshotRecordingEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeLocalSnapshotRecordingEnabledWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement LocalSnapshotRecordingEnabled write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeCameraAvStreamManagementLocalSnapshotRecordingEnabled : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementLocalSnapshotRecordingEnabled() : SubscribeAttribute("local-snapshot-recording-enabled") { } ~SubscribeAttributeCameraAvStreamManagementLocalSnapshotRecordingEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::LocalSnapshotRecordingEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLocalSnapshotRecordingEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.LocalSnapshotRecordingEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute StatusLightEnabled */ class ReadCameraAvStreamManagementStatusLightEnabled : public ReadAttribute { public: ReadCameraAvStreamManagementStatusLightEnabled() : ReadAttribute("status-light-enabled") { } ~ReadCameraAvStreamManagementStatusLightEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::StatusLightEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStatusLightEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.StatusLightEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement StatusLightEnabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementStatusLightEnabled : public WriteAttribute { public: WriteCameraAvStreamManagementStatusLightEnabled() : WriteAttribute("status-light-enabled") { AddArgument("attr-name", "status-light-enabled"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementStatusLightEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::StatusLightEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeStatusLightEnabledWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement StatusLightEnabled write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeCameraAvStreamManagementStatusLightEnabled : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementStatusLightEnabled() : SubscribeAttribute("status-light-enabled") { } ~SubscribeAttributeCameraAvStreamManagementStatusLightEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::StatusLightEnabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStatusLightEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.StatusLightEnabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute StatusLightBrightness */ class ReadCameraAvStreamManagementStatusLightBrightness : public ReadAttribute { public: ReadCameraAvStreamManagementStatusLightBrightness() : ReadAttribute("status-light-brightness") { } ~ReadCameraAvStreamManagementStatusLightBrightness() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::StatusLightBrightness::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStatusLightBrightnessWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.StatusLightBrightness response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement StatusLightBrightness read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementStatusLightBrightness : public WriteAttribute { public: WriteCameraAvStreamManagementStatusLightBrightness() : WriteAttribute("status-light-brightness") { AddArgument("attr-name", "status-light-brightness"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementStatusLightBrightness() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::StatusLightBrightness::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeStatusLightBrightnessWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement StatusLightBrightness write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeCameraAvStreamManagementStatusLightBrightness : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementStatusLightBrightness() : SubscribeAttribute("status-light-brightness") { } ~SubscribeAttributeCameraAvStreamManagementStatusLightBrightness() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::StatusLightBrightness::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStatusLightBrightnessWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.StatusLightBrightness response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute DepthSensorStatus */ class ReadCameraAvStreamManagementDepthSensorStatus : public ReadAttribute { public: ReadCameraAvStreamManagementDepthSensorStatus() : ReadAttribute("depth-sensor-status") { } ~ReadCameraAvStreamManagementDepthSensorStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::DepthSensorStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeDepthSensorStatusWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.DepthSensorStatus response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement DepthSensorStatus read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteCameraAvStreamManagementDepthSensorStatus : public WriteAttribute { public: WriteCameraAvStreamManagementDepthSensorStatus() : WriteAttribute("depth-sensor-status") { AddArgument("attr-name", "depth-sensor-status"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteCameraAvStreamManagementDepthSensorStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::DepthSensorStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeDepthSensorStatusWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("CameraAVStreamManagement DepthSensorStatus write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeCameraAvStreamManagementDepthSensorStatus : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementDepthSensorStatus() : SubscribeAttribute("depth-sensor-status") { } ~SubscribeAttributeCameraAvStreamManagementDepthSensorStatus() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::DepthSensorStatus::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDepthSensorStatusWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.DepthSensorStatus response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadCameraAvStreamManagementGeneratedCommandList : public ReadAttribute { public: ReadCameraAvStreamManagementGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadCameraAvStreamManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeCameraAvStreamManagementGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadCameraAvStreamManagementAcceptedCommandList : public ReadAttribute { public: ReadCameraAvStreamManagementAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadCameraAvStreamManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeCameraAvStreamManagementAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadCameraAvStreamManagementEventList : public ReadAttribute { public: ReadCameraAvStreamManagementEventList() : ReadAttribute("event-list") { } ~ReadCameraAvStreamManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementEventList : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeCameraAvStreamManagementEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadCameraAvStreamManagementAttributeList : public ReadAttribute { public: ReadCameraAvStreamManagementAttributeList() : ReadAttribute("attribute-list") { } ~ReadCameraAvStreamManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementAttributeList : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeCameraAvStreamManagementAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadCameraAvStreamManagementFeatureMap : public ReadAttribute { public: ReadCameraAvStreamManagementFeatureMap() : ReadAttribute("feature-map") { } ~ReadCameraAvStreamManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementFeatureMap : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeCameraAvStreamManagementFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadCameraAvStreamManagementClusterRevision : public ReadAttribute { public: ReadCameraAvStreamManagementClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadCameraAvStreamManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CameraAVStreamManagement ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCameraAvStreamManagementClusterRevision : public SubscribeAttribute { public: SubscribeAttributeCameraAvStreamManagementClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeCameraAvStreamManagementClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CameraAvStreamManagement::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CameraAvStreamManagement::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCameraAVStreamManagement alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CameraAVStreamManagement.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster WebRTCTransportProvider | 0x0553 | |------------------------------------------------------------------------------| | Commands: | | | * SolicitOffer | 0x01 | | * ProvideOffer | 0x03 | | * ProvideAnswer | 0x05 | | * ProvideICECandidate | 0x06 | | * EndSession | 0x07 | |------------------------------------------------------------------------------| | Attributes: | | | * CurrentSessions | 0x0000 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command SolicitOffer */ class WebRTCTransportProviderSolicitOffer : public ClusterCommand { public: WebRTCTransportProviderSolicitOffer() : ClusterCommand("solicit-offer") , mComplex_ICEServers(&mRequest.ICEServers) { #if MTR_ENABLE_PROVISIONAL AddArgument("StreamType", 0, UINT8_MAX, &mRequest.streamType); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("VideoStreamID", 0, UINT16_MAX, &mRequest.videoStreamID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("AudioStreamID", 0, UINT16_MAX, &mRequest.audioStreamID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ICEServers", &mComplex_ICEServers); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ICETransportPolicy", &mRequest.ICETransportPolicy); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MetadataOptions", 0, UINT8_MAX, &mRequest.metadataOptions); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportProvider::Commands::SolicitOffer::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWebRTCTransportProviderClusterSolicitOfferParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.streamType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.streamType)]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.videoStreamID.HasValue()) { if (mRequest.videoStreamID.Value().IsNull()) { params.videoStreamID = nil; } else { params.videoStreamID = [NSNumber numberWithUnsignedShort:mRequest.videoStreamID.Value().Value()]; } } else { params.videoStreamID = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.audioStreamID.HasValue()) { if (mRequest.audioStreamID.Value().IsNull()) { params.audioStreamID = nil; } else { params.audioStreamID = [NSNumber numberWithUnsignedShort:mRequest.audioStreamID.Value().Value()]; } } else { params.audioStreamID = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.ICEServers.HasValue()) { { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.ICEServers.Value()) { MTRWebRTCTransportProviderClusterICEServerStruct * newElement_1; newElement_1 = [MTRWebRTCTransportProviderClusterICEServerStruct new]; { // Scope for our temporary variables auto * array_3 = [NSMutableArray new]; for (auto & entry_3 : entry_1.urls) { NSString * newElement_3; newElement_3 = [[NSString alloc] initWithBytes:entry_3.data() length:entry_3.size() encoding:NSUTF8StringEncoding]; [array_3 addObject:newElement_3]; } newElement_1.urls = array_3; } if (entry_1.username.HasValue()) { newElement_1.username = [[NSString alloc] initWithBytes:entry_1.username.Value().data() length:entry_1.username.Value().size() encoding:NSUTF8StringEncoding]; } else { newElement_1.username = nil; } if (entry_1.credential.HasValue()) { newElement_1.credential = [[NSString alloc] initWithBytes:entry_1.credential.Value().data() length:entry_1.credential.Value().size() encoding:NSUTF8StringEncoding]; } else { newElement_1.credential = nil; } if (entry_1.caid.HasValue()) { newElement_1.caid = [NSNumber numberWithUnsignedShort:entry_1.caid.Value()]; } else { newElement_1.caid = nil; } [array_1 addObject:newElement_1]; } params.iceServers = array_1; } } else { params.iceServers = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.ICETransportPolicy.HasValue()) { params.iceTransportPolicy = [[NSString alloc] initWithBytes:mRequest.ICETransportPolicy.Value().data() length:mRequest.ICETransportPolicy.Value().size() encoding:NSUTF8StringEncoding]; } else { params.iceTransportPolicy = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.metadataOptions.HasValue()) { params.metadataOptions = [NSNumber numberWithUnsignedChar:mRequest.metadataOptions.Value().Raw()]; } else { params.metadataOptions = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster solicitOfferWithParams:params completion: ^(MTRWebRTCTransportProviderClusterSolicitOfferResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::WebRTCTransportProvider::Commands::SolicitOfferResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::WebRTCTransportProvider::Commands::SolicitOfferResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::WebRTCTransportProvider::Commands::SolicitOffer::Type mRequest; TypedComplexArgument>> mComplex_ICEServers; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command ProvideOffer */ class WebRTCTransportProviderProvideOffer : public ClusterCommand { public: WebRTCTransportProviderProvideOffer() : ClusterCommand("provide-offer") , mComplex_ICEServers(&mRequest.ICEServers) { #if MTR_ENABLE_PROVISIONAL AddArgument("WebRTCSessionID", 0, UINT16_MAX, &mRequest.webRTCSessionID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Sdp", &mRequest.sdp); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("StreamType", 0, UINT8_MAX, &mRequest.streamType); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("VideoStreamID", 0, UINT16_MAX, &mRequest.videoStreamID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("AudioStreamID", 0, UINT16_MAX, &mRequest.audioStreamID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ICEServers", &mComplex_ICEServers); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ICETransportPolicy", &mRequest.ICETransportPolicy); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("MetadataOptions", 0, UINT8_MAX, &mRequest.metadataOptions); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportProvider::Commands::ProvideOffer::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWebRTCTransportProviderClusterProvideOfferParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL if (mRequest.webRTCSessionID.IsNull()) { params.webRTCSessionID = nil; } else { params.webRTCSessionID = [NSNumber numberWithUnsignedShort:mRequest.webRTCSessionID.Value()]; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.sdp = [[NSString alloc] initWithBytes:mRequest.sdp.data() length:mRequest.sdp.size() encoding:NSUTF8StringEncoding]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.streamType = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.streamType)]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.videoStreamID.HasValue()) { if (mRequest.videoStreamID.Value().IsNull()) { params.videoStreamID = nil; } else { params.videoStreamID = [NSNumber numberWithUnsignedShort:mRequest.videoStreamID.Value().Value()]; } } else { params.videoStreamID = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.audioStreamID.HasValue()) { if (mRequest.audioStreamID.Value().IsNull()) { params.audioStreamID = nil; } else { params.audioStreamID = [NSNumber numberWithUnsignedShort:mRequest.audioStreamID.Value().Value()]; } } else { params.audioStreamID = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.ICEServers.HasValue()) { { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.ICEServers.Value()) { MTRWebRTCTransportProviderClusterICEServerStruct * newElement_1; newElement_1 = [MTRWebRTCTransportProviderClusterICEServerStruct new]; { // Scope for our temporary variables auto * array_3 = [NSMutableArray new]; for (auto & entry_3 : entry_1.urls) { NSString * newElement_3; newElement_3 = [[NSString alloc] initWithBytes:entry_3.data() length:entry_3.size() encoding:NSUTF8StringEncoding]; [array_3 addObject:newElement_3]; } newElement_1.urls = array_3; } if (entry_1.username.HasValue()) { newElement_1.username = [[NSString alloc] initWithBytes:entry_1.username.Value().data() length:entry_1.username.Value().size() encoding:NSUTF8StringEncoding]; } else { newElement_1.username = nil; } if (entry_1.credential.HasValue()) { newElement_1.credential = [[NSString alloc] initWithBytes:entry_1.credential.Value().data() length:entry_1.credential.Value().size() encoding:NSUTF8StringEncoding]; } else { newElement_1.credential = nil; } if (entry_1.caid.HasValue()) { newElement_1.caid = [NSNumber numberWithUnsignedShort:entry_1.caid.Value()]; } else { newElement_1.caid = nil; } [array_1 addObject:newElement_1]; } params.iceServers = array_1; } } else { params.iceServers = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.ICETransportPolicy.HasValue()) { params.iceTransportPolicy = [[NSString alloc] initWithBytes:mRequest.ICETransportPolicy.Value().data() length:mRequest.ICETransportPolicy.Value().size() encoding:NSUTF8StringEncoding]; } else { params.iceTransportPolicy = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.metadataOptions.HasValue()) { params.metadataOptions = [NSNumber numberWithUnsignedChar:mRequest.metadataOptions.Value().Raw()]; } else { params.metadataOptions = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster provideOfferWithParams:params completion: ^(MTRWebRTCTransportProviderClusterProvideOfferResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::WebRTCTransportProvider::Commands::ProvideOfferResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::WebRTCTransportProvider::Commands::ProvideOfferResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::WebRTCTransportProvider::Commands::ProvideOffer::Type mRequest; TypedComplexArgument>> mComplex_ICEServers; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command ProvideAnswer */ class WebRTCTransportProviderProvideAnswer : public ClusterCommand { public: WebRTCTransportProviderProvideAnswer() : ClusterCommand("provide-answer") { #if MTR_ENABLE_PROVISIONAL AddArgument("WebRTCSessionID", 0, UINT16_MAX, &mRequest.webRTCSessionID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Sdp", &mRequest.sdp); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportProvider::Commands::ProvideAnswer::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWebRTCTransportProviderClusterProvideAnswerParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.webRTCSessionID = [NSNumber numberWithUnsignedShort:mRequest.webRTCSessionID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.sdp = [[NSString alloc] initWithBytes:mRequest.sdp.data() length:mRequest.sdp.size() encoding:NSUTF8StringEncoding]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster provideAnswerWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::WebRTCTransportProvider::Commands::ProvideAnswer::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command ProvideICECandidate */ class WebRTCTransportProviderProvideICECandidate : public ClusterCommand { public: WebRTCTransportProviderProvideICECandidate() : ClusterCommand("provide-icecandidate") { #if MTR_ENABLE_PROVISIONAL AddArgument("WebRTCSessionID", 0, UINT16_MAX, &mRequest.webRTCSessionID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ICECandidate", &mRequest.ICECandidate); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportProvider::Commands::ProvideICECandidate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWebRTCTransportProviderClusterProvideICECandidateParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.webRTCSessionID = [NSNumber numberWithUnsignedShort:mRequest.webRTCSessionID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.iceCandidate = [[NSString alloc] initWithBytes:mRequest.ICECandidate.data() length:mRequest.ICECandidate.size() encoding:NSUTF8StringEncoding]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster provideICECandidateWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::WebRTCTransportProvider::Commands::ProvideICECandidate::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command EndSession */ class WebRTCTransportProviderEndSession : public ClusterCommand { public: WebRTCTransportProviderEndSession() : ClusterCommand("end-session") { #if MTR_ENABLE_PROVISIONAL AddArgument("WebRTCSessionID", 0, UINT16_MAX, &mRequest.webRTCSessionID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Reason", 0, UINT8_MAX, &mRequest.reason); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportProvider::Commands::EndSession::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWebRTCTransportProviderClusterEndSessionParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.webRTCSessionID = [NSNumber numberWithUnsignedShort:mRequest.webRTCSessionID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.reason = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.reason)]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster endSessionWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::WebRTCTransportProvider::Commands::EndSession::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentSessions */ class ReadWebRTCTransportProviderCurrentSessions : public ReadAttribute { public: ReadWebRTCTransportProviderCurrentSessions() : ReadAttribute("current-sessions") { } ~ReadWebRTCTransportProviderCurrentSessions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportProvider::Attributes::CurrentSessions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentSessionsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportProvider.CurrentSessions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WebRTCTransportProvider CurrentSessions read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWebRTCTransportProviderCurrentSessions : public SubscribeAttribute { public: SubscribeAttributeWebRTCTransportProviderCurrentSessions() : SubscribeAttribute("current-sessions") { } ~SubscribeAttributeWebRTCTransportProviderCurrentSessions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportProvider::Attributes::CurrentSessions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentSessionsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportProvider.CurrentSessions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadWebRTCTransportProviderGeneratedCommandList : public ReadAttribute { public: ReadWebRTCTransportProviderGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadWebRTCTransportProviderGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportProvider::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportProvider.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WebRTCTransportProvider GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWebRTCTransportProviderGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeWebRTCTransportProviderGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeWebRTCTransportProviderGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportProvider::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportProvider.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadWebRTCTransportProviderAcceptedCommandList : public ReadAttribute { public: ReadWebRTCTransportProviderAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadWebRTCTransportProviderAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportProvider::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportProvider.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WebRTCTransportProvider AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWebRTCTransportProviderAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeWebRTCTransportProviderAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeWebRTCTransportProviderAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportProvider::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportProvider.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadWebRTCTransportProviderEventList : public ReadAttribute { public: ReadWebRTCTransportProviderEventList() : ReadAttribute("event-list") { } ~ReadWebRTCTransportProviderEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportProvider::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportProvider.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WebRTCTransportProvider EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWebRTCTransportProviderEventList : public SubscribeAttribute { public: SubscribeAttributeWebRTCTransportProviderEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeWebRTCTransportProviderEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportProvider::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportProvider.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadWebRTCTransportProviderAttributeList : public ReadAttribute { public: ReadWebRTCTransportProviderAttributeList() : ReadAttribute("attribute-list") { } ~ReadWebRTCTransportProviderAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportProvider::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportProvider.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WebRTCTransportProvider AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWebRTCTransportProviderAttributeList : public SubscribeAttribute { public: SubscribeAttributeWebRTCTransportProviderAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeWebRTCTransportProviderAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportProvider::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportProvider.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadWebRTCTransportProviderFeatureMap : public ReadAttribute { public: ReadWebRTCTransportProviderFeatureMap() : ReadAttribute("feature-map") { } ~ReadWebRTCTransportProviderFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportProvider::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportProvider.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WebRTCTransportProvider FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWebRTCTransportProviderFeatureMap : public SubscribeAttribute { public: SubscribeAttributeWebRTCTransportProviderFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeWebRTCTransportProviderFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportProvider::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportProvider.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadWebRTCTransportProviderClusterRevision : public ReadAttribute { public: ReadWebRTCTransportProviderClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadWebRTCTransportProviderClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportProvider::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportProvider.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WebRTCTransportProvider ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWebRTCTransportProviderClusterRevision : public SubscribeAttribute { public: SubscribeAttributeWebRTCTransportProviderClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeWebRTCTransportProviderClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportProvider::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportProvider::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportProvider alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportProvider.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster WebRTCTransportRequestor | 0x0554 | |------------------------------------------------------------------------------| | Commands: | | | * Offer | 0x01 | | * Answer | 0x02 | | * ICECandidate | 0x03 | | * End | 0x04 | |------------------------------------------------------------------------------| | Attributes: | | | * CurrentSessions | 0x0000 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command Offer */ class WebRTCTransportRequestorOffer : public ClusterCommand { public: WebRTCTransportRequestorOffer() : ClusterCommand("offer") , mComplex_ICEServers(&mRequest.ICEServers) { #if MTR_ENABLE_PROVISIONAL AddArgument("WebRTCSessionID", 0, UINT16_MAX, &mRequest.webRTCSessionID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Sdp", &mRequest.sdp); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ICEServers", &mComplex_ICEServers); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ICETransportPolicy", &mRequest.ICETransportPolicy); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportRequestor::Commands::Offer::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWebRTCTransportRequestorClusterOfferParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.webRTCSessionID = [NSNumber numberWithUnsignedShort:mRequest.webRTCSessionID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.sdp = [[NSString alloc] initWithBytes:mRequest.sdp.data() length:mRequest.sdp.size() encoding:NSUTF8StringEncoding]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.ICEServers.HasValue()) { { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.ICEServers.Value()) { MTRWebRTCTransportRequestorClusterICEServerStruct * newElement_1; newElement_1 = [MTRWebRTCTransportRequestorClusterICEServerStruct new]; { // Scope for our temporary variables auto * array_3 = [NSMutableArray new]; for (auto & entry_3 : entry_1.urls) { NSString * newElement_3; newElement_3 = [[NSString alloc] initWithBytes:entry_3.data() length:entry_3.size() encoding:NSUTF8StringEncoding]; [array_3 addObject:newElement_3]; } newElement_1.urls = array_3; } if (entry_1.username.HasValue()) { newElement_1.username = [[NSString alloc] initWithBytes:entry_1.username.Value().data() length:entry_1.username.Value().size() encoding:NSUTF8StringEncoding]; } else { newElement_1.username = nil; } if (entry_1.credential.HasValue()) { newElement_1.credential = [[NSString alloc] initWithBytes:entry_1.credential.Value().data() length:entry_1.credential.Value().size() encoding:NSUTF8StringEncoding]; } else { newElement_1.credential = nil; } if (entry_1.caid.HasValue()) { newElement_1.caid = [NSNumber numberWithUnsignedShort:entry_1.caid.Value()]; } else { newElement_1.caid = nil; } [array_1 addObject:newElement_1]; } params.iceServers = array_1; } } else { params.iceServers = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.ICETransportPolicy.HasValue()) { params.iceTransportPolicy = [[NSString alloc] initWithBytes:mRequest.ICETransportPolicy.Value().data() length:mRequest.ICETransportPolicy.Value().size() encoding:NSUTF8StringEncoding]; } else { params.iceTransportPolicy = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster offerWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::WebRTCTransportRequestor::Commands::Offer::Type mRequest; TypedComplexArgument>> mComplex_ICEServers; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command Answer */ class WebRTCTransportRequestorAnswer : public ClusterCommand { public: WebRTCTransportRequestorAnswer() : ClusterCommand("answer") { #if MTR_ENABLE_PROVISIONAL AddArgument("WebRTCSessionID", 0, UINT16_MAX, &mRequest.webRTCSessionID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Sdp", &mRequest.sdp); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportRequestor::Commands::Answer::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWebRTCTransportRequestorClusterAnswerParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.webRTCSessionID = [NSNumber numberWithUnsignedShort:mRequest.webRTCSessionID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.sdp = [[NSString alloc] initWithBytes:mRequest.sdp.data() length:mRequest.sdp.size() encoding:NSUTF8StringEncoding]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster answerWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::WebRTCTransportRequestor::Commands::Answer::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command ICECandidate */ class WebRTCTransportRequestorICECandidate : public ClusterCommand { public: WebRTCTransportRequestorICECandidate() : ClusterCommand("icecandidate") { #if MTR_ENABLE_PROVISIONAL AddArgument("WebRTCSessionID", 0, UINT16_MAX, &mRequest.webRTCSessionID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ICECandidate", &mRequest.ICECandidate); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportRequestor::Commands::ICECandidate::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWebRTCTransportRequestorClusterICECandidateParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.webRTCSessionID = [NSNumber numberWithUnsignedShort:mRequest.webRTCSessionID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.iceCandidate = [[NSString alloc] initWithBytes:mRequest.ICECandidate.data() length:mRequest.ICECandidate.size() encoding:NSUTF8StringEncoding]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster ICECandidateWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::WebRTCTransportRequestor::Commands::ICECandidate::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command End */ class WebRTCTransportRequestorEnd : public ClusterCommand { public: WebRTCTransportRequestorEnd() : ClusterCommand("end") { #if MTR_ENABLE_PROVISIONAL AddArgument("WebRTCSessionID", 0, UINT16_MAX, &mRequest.webRTCSessionID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Reason", 0, UINT8_MAX, &mRequest.reason); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::CommandId commandId = chip::app::Clusters::WebRTCTransportRequestor::Commands::End::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWebRTCTransportRequestorClusterEndParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.webRTCSessionID = [NSNumber numberWithUnsignedShort:mRequest.webRTCSessionID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.reason = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.reason)]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster endWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::WebRTCTransportRequestor::Commands::End::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute CurrentSessions */ class ReadWebRTCTransportRequestorCurrentSessions : public ReadAttribute { public: ReadWebRTCTransportRequestorCurrentSessions() : ReadAttribute("current-sessions") { } ~ReadWebRTCTransportRequestorCurrentSessions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::CurrentSessions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCurrentSessionsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportRequestor.CurrentSessions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WebRTCTransportRequestor CurrentSessions read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWebRTCTransportRequestorCurrentSessions : public SubscribeAttribute { public: SubscribeAttributeWebRTCTransportRequestorCurrentSessions() : SubscribeAttribute("current-sessions") { } ~SubscribeAttributeWebRTCTransportRequestorCurrentSessions() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::CurrentSessions::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCurrentSessionsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportRequestor.CurrentSessions response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadWebRTCTransportRequestorGeneratedCommandList : public ReadAttribute { public: ReadWebRTCTransportRequestorGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadWebRTCTransportRequestorGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportRequestor.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WebRTCTransportRequestor GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWebRTCTransportRequestorGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeWebRTCTransportRequestorGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeWebRTCTransportRequestorGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportRequestor.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadWebRTCTransportRequestorAcceptedCommandList : public ReadAttribute { public: ReadWebRTCTransportRequestorAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadWebRTCTransportRequestorAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportRequestor.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WebRTCTransportRequestor AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWebRTCTransportRequestorAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeWebRTCTransportRequestorAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeWebRTCTransportRequestorAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportRequestor.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadWebRTCTransportRequestorEventList : public ReadAttribute { public: ReadWebRTCTransportRequestorEventList() : ReadAttribute("event-list") { } ~ReadWebRTCTransportRequestorEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportRequestor.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WebRTCTransportRequestor EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWebRTCTransportRequestorEventList : public SubscribeAttribute { public: SubscribeAttributeWebRTCTransportRequestorEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeWebRTCTransportRequestorEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportRequestor.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadWebRTCTransportRequestorAttributeList : public ReadAttribute { public: ReadWebRTCTransportRequestorAttributeList() : ReadAttribute("attribute-list") { } ~ReadWebRTCTransportRequestorAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportRequestor.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WebRTCTransportRequestor AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWebRTCTransportRequestorAttributeList : public SubscribeAttribute { public: SubscribeAttributeWebRTCTransportRequestorAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeWebRTCTransportRequestorAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportRequestor.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadWebRTCTransportRequestorFeatureMap : public ReadAttribute { public: ReadWebRTCTransportRequestorFeatureMap() : ReadAttribute("feature-map") { } ~ReadWebRTCTransportRequestorFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportRequestor.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WebRTCTransportRequestor FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWebRTCTransportRequestorFeatureMap : public SubscribeAttribute { public: SubscribeAttributeWebRTCTransportRequestorFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeWebRTCTransportRequestorFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportRequestor.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadWebRTCTransportRequestorClusterRevision : public ReadAttribute { public: ReadWebRTCTransportRequestorClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadWebRTCTransportRequestorClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportRequestor.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("WebRTCTransportRequestor ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeWebRTCTransportRequestorClusterRevision : public SubscribeAttribute { public: SubscribeAttributeWebRTCTransportRequestorClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeWebRTCTransportRequestorClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::WebRTCTransportRequestor::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::WebRTCTransportRequestor::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterWebRTCTransportRequestor alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WebRTCTransportRequestor.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster Chime | 0x0556 | |------------------------------------------------------------------------------| | Commands: | | | * PlayChimeSound | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | | * InstalledChimeSounds | 0x0000 | | * ActiveChimeID | 0x0001 | | * Enabled | 0x0002 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command PlayChimeSound */ class ChimePlayChimeSound : public ClusterCommand { public: ChimePlayChimeSound() : ClusterCommand("play-chime-sound") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::CommandId commandId = chip::app::Clusters::Chime::Commands::PlayChimeSound::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRChimeClusterPlayChimeSoundParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster playChimeSoundWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute InstalledChimeSounds */ class ReadChimeInstalledChimeSounds : public ReadAttribute { public: ReadChimeInstalledChimeSounds() : ReadAttribute("installed-chime-sounds") { } ~ReadChimeInstalledChimeSounds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Chime::Attributes::InstalledChimeSounds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInstalledChimeSoundsWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.InstalledChimeSounds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Chime InstalledChimeSounds read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeChimeInstalledChimeSounds : public SubscribeAttribute { public: SubscribeAttributeChimeInstalledChimeSounds() : SubscribeAttribute("installed-chime-sounds") { } ~SubscribeAttributeChimeInstalledChimeSounds() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Chime::Attributes::InstalledChimeSounds::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInstalledChimeSoundsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.InstalledChimeSounds response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ActiveChimeID */ class ReadChimeActiveChimeID : public ReadAttribute { public: ReadChimeActiveChimeID() : ReadAttribute("active-chime-id") { } ~ReadChimeActiveChimeID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Chime::Attributes::ActiveChimeID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeActiveChimeIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.ActiveChimeID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Chime ActiveChimeID read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteChimeActiveChimeID : public WriteAttribute { public: WriteChimeActiveChimeID() : WriteAttribute("active-chime-id") { AddArgument("attr-name", "active-chime-id"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteChimeActiveChimeID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Chime::Attributes::ActiveChimeID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeActiveChimeIDWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Chime ActiveChimeID write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeChimeActiveChimeID : public SubscribeAttribute { public: SubscribeAttributeChimeActiveChimeID() : SubscribeAttribute("active-chime-id") { } ~SubscribeAttributeChimeActiveChimeID() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Chime::Attributes::ActiveChimeID::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeActiveChimeIDWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.ActiveChimeID response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute Enabled */ class ReadChimeEnabled : public ReadAttribute { public: ReadChimeEnabled() : ReadAttribute("enabled") { } ~ReadChimeEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Chime::Attributes::Enabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEnabledWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.Enabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Chime Enabled read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteChimeEnabled : public WriteAttribute { public: WriteChimeEnabled() : WriteAttribute("enabled") { AddArgument("attr-name", "enabled"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteChimeEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Chime::Attributes::Enabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeEnabledWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("Chime Enabled write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeChimeEnabled : public SubscribeAttribute { public: SubscribeAttributeChimeEnabled() : SubscribeAttribute("enabled") { } ~SubscribeAttributeChimeEnabled() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Chime::Attributes::Enabled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEnabledWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.Enabled response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadChimeGeneratedCommandList : public ReadAttribute { public: ReadChimeGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadChimeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Chime::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Chime GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeChimeGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeChimeGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeChimeGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Chime::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadChimeAcceptedCommandList : public ReadAttribute { public: ReadChimeAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadChimeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Chime::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Chime AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeChimeAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeChimeAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeChimeAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Chime::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadChimeEventList : public ReadAttribute { public: ReadChimeEventList() : ReadAttribute("event-list") { } ~ReadChimeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Chime::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Chime EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeChimeEventList : public SubscribeAttribute { public: SubscribeAttributeChimeEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeChimeEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Chime::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadChimeAttributeList : public ReadAttribute { public: ReadChimeAttributeList() : ReadAttribute("attribute-list") { } ~ReadChimeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Chime::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Chime AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeChimeAttributeList : public SubscribeAttribute { public: SubscribeAttributeChimeAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeChimeAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Chime::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadChimeFeatureMap : public ReadAttribute { public: ReadChimeFeatureMap() : ReadAttribute("feature-map") { } ~ReadChimeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Chime::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Chime FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeChimeFeatureMap : public SubscribeAttribute { public: SubscribeAttributeChimeFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeChimeFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Chime::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadChimeClusterRevision : public ReadAttribute { public: ReadChimeClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadChimeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::Chime::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("Chime ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeChimeClusterRevision : public SubscribeAttribute { public: SubscribeAttributeChimeClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeChimeClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::Chime::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::Chime::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterChime alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Chime.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster EcosystemInformation | 0x0750 | |------------------------------------------------------------------------------| | Commands: | | |------------------------------------------------------------------------------| | Attributes: | | | * DeviceDirectory | 0x0000 | | * LocationDirectory | 0x0001 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Attribute DeviceDirectory */ class ReadEcosystemInformationDeviceDirectory : public ReadAttribute { public: ReadEcosystemInformationDeviceDirectory() : ReadAttribute("device-directory") { } ~ReadEcosystemInformationDeviceDirectory() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::DeviceDirectory::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRReadParams alloc] init]; if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } [cluster readAttributeDeviceDirectoryWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EcosystemInformation.DeviceDirectory response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EcosystemInformation DeviceDirectory read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEcosystemInformationDeviceDirectory : public SubscribeAttribute { public: SubscribeAttributeEcosystemInformationDeviceDirectory() : SubscribeAttribute("device-directory") { } ~SubscribeAttributeEcosystemInformationDeviceDirectory() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::DeviceDirectory::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeDeviceDirectoryWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EcosystemInformation.DeviceDirectory response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute LocationDirectory */ class ReadEcosystemInformationLocationDirectory : public ReadAttribute { public: ReadEcosystemInformationLocationDirectory() : ReadAttribute("location-directory") { } ~ReadEcosystemInformationLocationDirectory() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::LocationDirectory::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRReadParams alloc] init]; if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } [cluster readAttributeLocationDirectoryWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EcosystemInformation.LocationDirectory response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EcosystemInformation LocationDirectory read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEcosystemInformationLocationDirectory : public SubscribeAttribute { public: SubscribeAttributeEcosystemInformationLocationDirectory() : SubscribeAttribute("location-directory") { } ~SubscribeAttributeEcosystemInformationLocationDirectory() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::LocationDirectory::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLocationDirectoryWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EcosystemInformation.LocationDirectory response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadEcosystemInformationGeneratedCommandList : public ReadAttribute { public: ReadEcosystemInformationGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadEcosystemInformationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EcosystemInformation.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EcosystemInformation GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEcosystemInformationGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeEcosystemInformationGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeEcosystemInformationGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EcosystemInformation.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadEcosystemInformationAcceptedCommandList : public ReadAttribute { public: ReadEcosystemInformationAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadEcosystemInformationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EcosystemInformation.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EcosystemInformation AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEcosystemInformationAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeEcosystemInformationAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeEcosystemInformationAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EcosystemInformation.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadEcosystemInformationEventList : public ReadAttribute { public: ReadEcosystemInformationEventList() : ReadAttribute("event-list") { } ~ReadEcosystemInformationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EcosystemInformation.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EcosystemInformation EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEcosystemInformationEventList : public SubscribeAttribute { public: SubscribeAttributeEcosystemInformationEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeEcosystemInformationEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EcosystemInformation.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadEcosystemInformationAttributeList : public ReadAttribute { public: ReadEcosystemInformationAttributeList() : ReadAttribute("attribute-list") { } ~ReadEcosystemInformationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EcosystemInformation.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EcosystemInformation AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEcosystemInformationAttributeList : public SubscribeAttribute { public: SubscribeAttributeEcosystemInformationAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeEcosystemInformationAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EcosystemInformation.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadEcosystemInformationFeatureMap : public ReadAttribute { public: ReadEcosystemInformationFeatureMap() : ReadAttribute("feature-map") { } ~ReadEcosystemInformationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EcosystemInformation.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EcosystemInformation FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEcosystemInformationFeatureMap : public SubscribeAttribute { public: SubscribeAttributeEcosystemInformationFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeEcosystemInformationFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EcosystemInformation.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadEcosystemInformationClusterRevision : public ReadAttribute { public: ReadEcosystemInformationClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadEcosystemInformationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EcosystemInformation.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("EcosystemInformation ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeEcosystemInformationClusterRevision : public SubscribeAttribute { public: SubscribeAttributeEcosystemInformationClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeEcosystemInformationClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::EcosystemInformation::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::EcosystemInformation::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterEcosystemInformation alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EcosystemInformation.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster CommissionerControl | 0x0751 | |------------------------------------------------------------------------------| | Commands: | | | * RequestCommissioningApproval | 0x00 | | * CommissionNode | 0x01 | |------------------------------------------------------------------------------| | Attributes: | | | * SupportedDeviceCategories | 0x0000 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * CommissioningRequestResult | 0x0000 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command RequestCommissioningApproval */ class CommissionerControlRequestCommissioningApproval : public ClusterCommand { public: CommissionerControlRequestCommissioningApproval() : ClusterCommand("request-commissioning-approval") { #if MTR_ENABLE_PROVISIONAL AddArgument("RequestID", 0, UINT64_MAX, &mRequest.requestID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("VendorID", 0, UINT16_MAX, &mRequest.vendorID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ProductID", 0, UINT16_MAX, &mRequest.productID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Label", &mRequest.label); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::CommissionerControl::Commands::RequestCommissioningApproval::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRCommissionerControlClusterRequestCommissioningApprovalParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.requestID = [NSNumber numberWithUnsignedLongLong:mRequest.requestID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.vendorID = [NSNumber numberWithUnsignedShort:chip::to_underlying(mRequest.vendorID)]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.productID = [NSNumber numberWithUnsignedShort:mRequest.productID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL if (mRequest.label.HasValue()) { params.label = [[NSString alloc] initWithBytes:mRequest.label.Value().data() length:mRequest.label.Value().size() encoding:NSUTF8StringEncoding]; } else { params.label = nil; } #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster requestCommissioningApprovalWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::CommissionerControl::Commands::RequestCommissioningApproval::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command CommissionNode */ class CommissionerControlCommissionNode : public ClusterCommand { public: CommissionerControlCommissionNode() : ClusterCommand("commission-node") { #if MTR_ENABLE_PROVISIONAL AddArgument("RequestID", 0, UINT64_MAX, &mRequest.requestID); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("ResponseTimeoutSeconds", 0, UINT16_MAX, &mRequest.responseTimeoutSeconds); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; constexpr chip::CommandId commandId = chip::app::Clusters::CommissionerControl::Commands::CommissionNode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRCommissionerControlClusterCommissionNodeParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.requestID = [NSNumber numberWithUnsignedLongLong:mRequest.requestID]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.responseTimeoutSeconds = [NSNumber numberWithUnsignedShort:mRequest.responseTimeoutSeconds]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster commissionNodeWithParams:params completion: ^(MTRCommissionerControlClusterReverseOpenCommissioningWindowParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::CommissionerControl::Commands::ReverseOpenCommissioningWindow::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::CommissionerControl::Commands::ReverseOpenCommissioningWindow::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::CommissionerControl::Commands::CommissionNode::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute SupportedDeviceCategories */ class ReadCommissionerControlSupportedDeviceCategories : public ReadAttribute { public: ReadCommissionerControlSupportedDeviceCategories() : ReadAttribute("supported-device-categories") { } ~ReadCommissionerControlSupportedDeviceCategories() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CommissionerControl::Attributes::SupportedDeviceCategories::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeSupportedDeviceCategoriesWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CommissionerControl.SupportedDeviceCategories response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CommissionerControl SupportedDeviceCategories read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCommissionerControlSupportedDeviceCategories : public SubscribeAttribute { public: SubscribeAttributeCommissionerControlSupportedDeviceCategories() : SubscribeAttribute("supported-device-categories") { } ~SubscribeAttributeCommissionerControlSupportedDeviceCategories() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CommissionerControl::Attributes::SupportedDeviceCategories::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeSupportedDeviceCategoriesWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CommissionerControl.SupportedDeviceCategories response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadCommissionerControlGeneratedCommandList : public ReadAttribute { public: ReadCommissionerControlGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadCommissionerControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CommissionerControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CommissionerControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CommissionerControl GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCommissionerControlGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeCommissionerControlGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeCommissionerControlGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CommissionerControl::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CommissionerControl.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadCommissionerControlAcceptedCommandList : public ReadAttribute { public: ReadCommissionerControlAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadCommissionerControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CommissionerControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CommissionerControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CommissionerControl AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCommissionerControlAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeCommissionerControlAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeCommissionerControlAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CommissionerControl::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CommissionerControl.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadCommissionerControlEventList : public ReadAttribute { public: ReadCommissionerControlEventList() : ReadAttribute("event-list") { } ~ReadCommissionerControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CommissionerControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CommissionerControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CommissionerControl EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCommissionerControlEventList : public SubscribeAttribute { public: SubscribeAttributeCommissionerControlEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeCommissionerControlEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CommissionerControl::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CommissionerControl.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadCommissionerControlAttributeList : public ReadAttribute { public: ReadCommissionerControlAttributeList() : ReadAttribute("attribute-list") { } ~ReadCommissionerControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CommissionerControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CommissionerControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CommissionerControl AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCommissionerControlAttributeList : public SubscribeAttribute { public: SubscribeAttributeCommissionerControlAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeCommissionerControlAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CommissionerControl::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"CommissionerControl.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadCommissionerControlFeatureMap : public ReadAttribute { public: ReadCommissionerControlFeatureMap() : ReadAttribute("feature-map") { } ~ReadCommissionerControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CommissionerControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CommissionerControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CommissionerControl FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCommissionerControlFeatureMap : public SubscribeAttribute { public: SubscribeAttributeCommissionerControlFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeCommissionerControlFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CommissionerControl::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CommissionerControl.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadCommissionerControlClusterRevision : public ReadAttribute { public: ReadCommissionerControlClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadCommissionerControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::CommissionerControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CommissionerControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("CommissionerControl ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeCommissionerControlClusterRevision : public SubscribeAttribute { public: SubscribeAttributeCommissionerControlClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeCommissionerControlClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::CommissionerControl::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::CommissionerControl::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterCommissionerControl alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"CommissionerControl.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster UnitTesting | 0xFFF1FC05 | |------------------------------------------------------------------------------| | Commands: | | | * Test | 0x00 | | * TestNotHandled | 0x01 | | * TestSpecific | 0x02 | | * TestUnknownCommand | 0x03 | | * TestAddArguments | 0x04 | | * TestSimpleArgumentRequest | 0x05 | | * TestStructArrayArgumentRequest | 0x06 | | * TestStructArgumentRequest | 0x07 | | * TestNestedStructArgumentRequest | 0x08 | | * TestListStructArgumentRequest | 0x09 | | * TestListInt8UArgumentRequest | 0x0A | | * TestNestedStructListArgumentRequest | 0x0B | | * TestListNestedStructListArgumentRequest | 0x0C | | * TestListInt8UReverseRequest | 0x0D | | * TestEnumsRequest | 0x0E | | * TestNullableOptionalRequest | 0x0F | | * TestComplexNullableOptionalRequest | 0x10 | | * SimpleStructEchoRequest | 0x11 | | * TimedInvokeRequest | 0x12 | | * TestSimpleOptionalArgumentRequest | 0x13 | | * TestEmitTestEventRequest | 0x14 | | * TestEmitTestFabricScopedEventRequest | 0x15 | | * TestBatchHelperRequest | 0x16 | | * TestSecondBatchHelperRequest | 0x17 | | * StringEchoRequest | 0x18 | | * GlobalEchoRequest | 0x19 | | * TestDifferentVendorMeiRequest | 0xFFF200AA| |------------------------------------------------------------------------------| | Attributes: | | | * Boolean | 0x0000 | | * Bitmap8 | 0x0001 | | * Bitmap16 | 0x0002 | | * Bitmap32 | 0x0003 | | * Bitmap64 | 0x0004 | | * Int8u | 0x0005 | | * Int16u | 0x0006 | | * Int24u | 0x0007 | | * Int32u | 0x0008 | | * Int40u | 0x0009 | | * Int48u | 0x000A | | * Int56u | 0x000B | | * Int64u | 0x000C | | * Int8s | 0x000D | | * Int16s | 0x000E | | * Int24s | 0x000F | | * Int32s | 0x0010 | | * Int40s | 0x0011 | | * Int48s | 0x0012 | | * Int56s | 0x0013 | | * Int64s | 0x0014 | | * Enum8 | 0x0015 | | * Enum16 | 0x0016 | | * FloatSingle | 0x0017 | | * FloatDouble | 0x0018 | | * OctetString | 0x0019 | | * ListInt8u | 0x001A | | * ListOctetString | 0x001B | | * ListStructOctetString | 0x001C | | * LongOctetString | 0x001D | | * CharString | 0x001E | | * LongCharString | 0x001F | | * EpochUs | 0x0020 | | * EpochS | 0x0021 | | * VendorId | 0x0022 | | * ListNullablesAndOptionalsStruct | 0x0023 | | * EnumAttr | 0x0024 | | * StructAttr | 0x0025 | | * RangeRestrictedInt8u | 0x0026 | | * RangeRestrictedInt8s | 0x0027 | | * RangeRestrictedInt16u | 0x0028 | | * RangeRestrictedInt16s | 0x0029 | | * ListLongOctetString | 0x002A | | * ListFabricScoped | 0x002B | | * TimedWriteBoolean | 0x0030 | | * GeneralErrorBoolean | 0x0031 | | * ClusterErrorBoolean | 0x0032 | | * GlobalEnum | 0x0033 | | * GlobalStruct | 0x0034 | | * Unsupported | 0x00FF | | * ReadFailureCode | 0x3000 | | * FailureInt32U | 0x3001 | | * NullableBoolean | 0x4000 | | * NullableBitmap8 | 0x4001 | | * NullableBitmap16 | 0x4002 | | * NullableBitmap32 | 0x4003 | | * NullableBitmap64 | 0x4004 | | * NullableInt8u | 0x4005 | | * NullableInt16u | 0x4006 | | * NullableInt24u | 0x4007 | | * NullableInt32u | 0x4008 | | * NullableInt40u | 0x4009 | | * NullableInt48u | 0x400A | | * NullableInt56u | 0x400B | | * NullableInt64u | 0x400C | | * NullableInt8s | 0x400D | | * NullableInt16s | 0x400E | | * NullableInt24s | 0x400F | | * NullableInt32s | 0x4010 | | * NullableInt40s | 0x4011 | | * NullableInt48s | 0x4012 | | * NullableInt56s | 0x4013 | | * NullableInt64s | 0x4014 | | * NullableEnum8 | 0x4015 | | * NullableEnum16 | 0x4016 | | * NullableFloatSingle | 0x4017 | | * NullableFloatDouble | 0x4018 | | * NullableOctetString | 0x4019 | | * NullableCharString | 0x401E | | * NullableEnumAttr | 0x4024 | | * NullableStruct | 0x4025 | | * NullableRangeRestrictedInt8u | 0x4026 | | * NullableRangeRestrictedInt8s | 0x4027 | | * NullableRangeRestrictedInt16u | 0x4028 | | * NullableRangeRestrictedInt16s | 0x4029 | | * WriteOnlyInt8u | 0x402A | | * NullableGlobalEnum | 0x4033 | | * NullableGlobalStruct | 0x4034 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | | * MeiInt8u | 0xFFF24F01| |------------------------------------------------------------------------------| | Events: | | | * TestEvent | 0x0001 | | * TestFabricScopedEvent | 0x0002 | | * TestDifferentVendorMeiEvent | 0xFFF200EE| \*----------------------------------------------------------------------------*/ /* * Command Test */ class UnitTestingTest : public ClusterCommand { public: UnitTestingTest() : ClusterCommand("test") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::Test::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command TestNotHandled */ class UnitTestingTestNotHandled : public ClusterCommand { public: UnitTestingTestNotHandled() : ClusterCommand("test-not-handled") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestNotHandled::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestNotHandledParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testNotHandledWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command TestSpecific */ class UnitTestingTestSpecific : public ClusterCommand { public: UnitTestingTestSpecific() : ClusterCommand("test-specific") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestSpecific::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestSpecificParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testSpecificWithParams:params completion: ^(MTRUnitTestingClusterTestSpecificResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestSpecificResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestSpecificResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command TestUnknownCommand */ class UnitTestingTestUnknownCommand : public ClusterCommand { public: UnitTestingTestUnknownCommand() : ClusterCommand("test-unknown-command") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestUnknownCommand::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestUnknownCommandParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testUnknownCommandWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command TestAddArguments */ class UnitTestingTestAddArguments : public ClusterCommand { public: UnitTestingTestAddArguments() : ClusterCommand("test-add-arguments") { AddArgument("Arg1", 0, UINT8_MAX, &mRequest.arg1); AddArgument("Arg2", 0, UINT8_MAX, &mRequest.arg2); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestAddArguments::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestAddArgumentsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.arg1 = [NSNumber numberWithUnsignedChar:mRequest.arg1]; params.arg2 = [NSNumber numberWithUnsignedChar:mRequest.arg2]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testAddArgumentsWithParams:params completion: ^(MTRUnitTestingClusterTestAddArgumentsResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestAddArgumentsResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestAddArgumentsResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestAddArguments::Type mRequest; }; /* * Command TestSimpleArgumentRequest */ class UnitTestingTestSimpleArgumentRequest : public ClusterCommand { public: UnitTestingTestSimpleArgumentRequest() : ClusterCommand("test-simple-argument-request") { AddArgument("Arg1", 0, 1, &mRequest.arg1); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestSimpleArgumentRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestSimpleArgumentRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.arg1 = [NSNumber numberWithBool:mRequest.arg1]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testSimpleArgumentRequestWithParams:params completion: ^(MTRUnitTestingClusterTestSimpleArgumentResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestSimpleArgumentResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestSimpleArgumentResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestSimpleArgumentRequest::Type mRequest; }; /* * Command TestStructArrayArgumentRequest */ class UnitTestingTestStructArrayArgumentRequest : public ClusterCommand { public: UnitTestingTestStructArrayArgumentRequest() : ClusterCommand("test-struct-array-argument-request") , mComplex_Arg1(&mRequest.arg1) , mComplex_Arg2(&mRequest.arg2) , mComplex_Arg3(&mRequest.arg3) , mComplex_Arg4(&mRequest.arg4) { AddArgument("Arg1", &mComplex_Arg1); AddArgument("Arg2", &mComplex_Arg2); AddArgument("Arg3", &mComplex_Arg3); AddArgument("Arg4", &mComplex_Arg4); AddArgument("Arg5", 0, UINT8_MAX, &mRequest.arg5); AddArgument("Arg6", 0, 1, &mRequest.arg6); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestStructArrayArgumentRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestStructArrayArgumentRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.arg1) { MTRUnitTestingClusterNestedStructList * newElement_0; newElement_0 = [MTRUnitTestingClusterNestedStructList new]; newElement_0.a = [NSNumber numberWithUnsignedChar:entry_0.a]; newElement_0.b = [NSNumber numberWithBool:entry_0.b]; newElement_0.c = [MTRUnitTestingClusterSimpleStruct new]; newElement_0.c.a = [NSNumber numberWithUnsignedChar:entry_0.c.a]; newElement_0.c.b = [NSNumber numberWithBool:entry_0.c.b]; newElement_0.c.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c.c)]; newElement_0.c.d = [NSData dataWithBytes:entry_0.c.d.data() length:entry_0.c.d.size()]; newElement_0.c.e = [[NSString alloc] initWithBytes:entry_0.c.e.data() length:entry_0.c.e.size() encoding:NSUTF8StringEncoding]; newElement_0.c.f = [NSNumber numberWithUnsignedChar:entry_0.c.f.Raw()]; newElement_0.c.g = [NSNumber numberWithFloat:entry_0.c.g]; newElement_0.c.h = [NSNumber numberWithDouble:entry_0.c.h]; if (entry_0.c.i.HasValue()) { newElement_0.c.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c.i.Value())]; } else { newElement_0.c.i = nil; } { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.d) { MTRUnitTestingClusterSimpleStruct * newElement_2; newElement_2 = [MTRUnitTestingClusterSimpleStruct new]; newElement_2.a = [NSNumber numberWithUnsignedChar:entry_2.a]; newElement_2.b = [NSNumber numberWithBool:entry_2.b]; newElement_2.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.c)]; newElement_2.d = [NSData dataWithBytes:entry_2.d.data() length:entry_2.d.size()]; newElement_2.e = [[NSString alloc] initWithBytes:entry_2.e.data() length:entry_2.e.size() encoding:NSUTF8StringEncoding]; newElement_2.f = [NSNumber numberWithUnsignedChar:entry_2.f.Raw()]; newElement_2.g = [NSNumber numberWithFloat:entry_2.g]; newElement_2.h = [NSNumber numberWithDouble:entry_2.h]; if (entry_2.i.HasValue()) { newElement_2.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.i.Value())]; } else { newElement_2.i = nil; } [array_2 addObject:newElement_2]; } newElement_0.d = array_2; } { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.e) { NSNumber * newElement_2; newElement_2 = [NSNumber numberWithUnsignedInt:entry_2]; [array_2 addObject:newElement_2]; } newElement_0.e = array_2; } { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.f) { NSData * newElement_2; newElement_2 = [NSData dataWithBytes:entry_2.data() length:entry_2.size()]; [array_2 addObject:newElement_2]; } newElement_0.f = array_2; } { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.g) { NSNumber * newElement_2; newElement_2 = [NSNumber numberWithUnsignedChar:entry_2]; [array_2 addObject:newElement_2]; } newElement_0.g = array_2; } [array_0 addObject:newElement_0]; } params.arg1 = array_0; } { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.arg2) { MTRUnitTestingClusterSimpleStruct * newElement_0; newElement_0 = [MTRUnitTestingClusterSimpleStruct new]; newElement_0.a = [NSNumber numberWithUnsignedChar:entry_0.a]; newElement_0.b = [NSNumber numberWithBool:entry_0.b]; newElement_0.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c)]; newElement_0.d = [NSData dataWithBytes:entry_0.d.data() length:entry_0.d.size()]; newElement_0.e = [[NSString alloc] initWithBytes:entry_0.e.data() length:entry_0.e.size() encoding:NSUTF8StringEncoding]; newElement_0.f = [NSNumber numberWithUnsignedChar:entry_0.f.Raw()]; newElement_0.g = [NSNumber numberWithFloat:entry_0.g]; newElement_0.h = [NSNumber numberWithDouble:entry_0.h]; if (entry_0.i.HasValue()) { newElement_0.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.i.Value())]; } else { newElement_0.i = nil; } [array_0 addObject:newElement_0]; } params.arg2 = array_0; } { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.arg3) { NSNumber * newElement_0; newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; [array_0 addObject:newElement_0]; } params.arg3 = array_0; } { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.arg4) { NSNumber * newElement_0; newElement_0 = [NSNumber numberWithBool:entry_0]; [array_0 addObject:newElement_0]; } params.arg4 = array_0; } params.arg5 = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg5)]; params.arg6 = [NSNumber numberWithBool:mRequest.arg6]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testStructArrayArgumentRequestWithParams:params completion: ^(MTRUnitTestingClusterTestStructArrayArgumentResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestStructArrayArgumentResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestStructArrayArgumentResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestStructArrayArgumentRequest::Type mRequest; TypedComplexArgument> mComplex_Arg1; TypedComplexArgument> mComplex_Arg2; TypedComplexArgument> mComplex_Arg3; TypedComplexArgument> mComplex_Arg4; }; /* * Command TestStructArgumentRequest */ class UnitTestingTestStructArgumentRequest : public ClusterCommand { public: UnitTestingTestStructArgumentRequest() : ClusterCommand("test-struct-argument-request") , mComplex_Arg1(&mRequest.arg1) { AddArgument("Arg1", &mComplex_Arg1); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestStructArgumentRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestStructArgumentRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.arg1 = [MTRUnitTestingClusterSimpleStruct new]; params.arg1.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.a]; params.arg1.b = [NSNumber numberWithBool:mRequest.arg1.b]; params.arg1.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.c)]; params.arg1.d = [NSData dataWithBytes:mRequest.arg1.d.data() length:mRequest.arg1.d.size()]; params.arg1.e = [[NSString alloc] initWithBytes:mRequest.arg1.e.data() length:mRequest.arg1.e.size() encoding:NSUTF8StringEncoding]; params.arg1.f = [NSNumber numberWithUnsignedChar:mRequest.arg1.f.Raw()]; params.arg1.g = [NSNumber numberWithFloat:mRequest.arg1.g]; params.arg1.h = [NSNumber numberWithDouble:mRequest.arg1.h]; if (mRequest.arg1.i.HasValue()) { params.arg1.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.i.Value())]; } else { params.arg1.i = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testStructArgumentRequestWithParams:params completion: ^(MTRUnitTestingClusterBooleanResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::BooleanResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::BooleanResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestStructArgumentRequest::Type mRequest; TypedComplexArgument mComplex_Arg1; }; /* * Command TestNestedStructArgumentRequest */ class UnitTestingTestNestedStructArgumentRequest : public ClusterCommand { public: UnitTestingTestNestedStructArgumentRequest() : ClusterCommand("test-nested-struct-argument-request") , mComplex_Arg1(&mRequest.arg1) { AddArgument("Arg1", &mComplex_Arg1); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestNestedStructArgumentRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestNestedStructArgumentRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.arg1 = [MTRUnitTestingClusterNestedStruct new]; params.arg1.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.a]; params.arg1.b = [NSNumber numberWithBool:mRequest.arg1.b]; params.arg1.c = [MTRUnitTestingClusterSimpleStruct new]; params.arg1.c.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.c.a]; params.arg1.c.b = [NSNumber numberWithBool:mRequest.arg1.c.b]; params.arg1.c.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.c.c)]; params.arg1.c.d = [NSData dataWithBytes:mRequest.arg1.c.d.data() length:mRequest.arg1.c.d.size()]; params.arg1.c.e = [[NSString alloc] initWithBytes:mRequest.arg1.c.e.data() length:mRequest.arg1.c.e.size() encoding:NSUTF8StringEncoding]; params.arg1.c.f = [NSNumber numberWithUnsignedChar:mRequest.arg1.c.f.Raw()]; params.arg1.c.g = [NSNumber numberWithFloat:mRequest.arg1.c.g]; params.arg1.c.h = [NSNumber numberWithDouble:mRequest.arg1.c.h]; if (mRequest.arg1.c.i.HasValue()) { params.arg1.c.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.c.i.Value())]; } else { params.arg1.c.i = nil; } if (mRequest.arg1.d.HasValue()) { params.arg1.d = [MTRDataTypeTestGlobalStruct new]; params.arg1.d.name = [[NSString alloc] initWithBytes:mRequest.arg1.d.Value().name.data() length:mRequest.arg1.d.Value().name.size() encoding:NSUTF8StringEncoding]; if (mRequest.arg1.d.Value().myBitmap.IsNull()) { params.arg1.d.myBitmap = nil; } else { params.arg1.d.myBitmap = [NSNumber numberWithUnsignedInt:mRequest.arg1.d.Value().myBitmap.Value().Raw()]; } if (mRequest.arg1.d.Value().myEnum.HasValue()) { if (mRequest.arg1.d.Value().myEnum.Value().IsNull()) { params.arg1.d.myEnum = nil; } else { params.arg1.d.myEnum = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.d.Value().myEnum.Value().Value())]; } } else { params.arg1.d.myEnum = nil; } } else { params.arg1.d = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testNestedStructArgumentRequestWithParams:params completion: ^(MTRUnitTestingClusterBooleanResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::BooleanResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::BooleanResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestNestedStructArgumentRequest::Type mRequest; TypedComplexArgument mComplex_Arg1; }; /* * Command TestListStructArgumentRequest */ class UnitTestingTestListStructArgumentRequest : public ClusterCommand { public: UnitTestingTestListStructArgumentRequest() : ClusterCommand("test-list-struct-argument-request") , mComplex_Arg1(&mRequest.arg1) { AddArgument("Arg1", &mComplex_Arg1); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestListStructArgumentRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestListStructArgumentRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.arg1) { MTRUnitTestingClusterSimpleStruct * newElement_0; newElement_0 = [MTRUnitTestingClusterSimpleStruct new]; newElement_0.a = [NSNumber numberWithUnsignedChar:entry_0.a]; newElement_0.b = [NSNumber numberWithBool:entry_0.b]; newElement_0.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c)]; newElement_0.d = [NSData dataWithBytes:entry_0.d.data() length:entry_0.d.size()]; newElement_0.e = [[NSString alloc] initWithBytes:entry_0.e.data() length:entry_0.e.size() encoding:NSUTF8StringEncoding]; newElement_0.f = [NSNumber numberWithUnsignedChar:entry_0.f.Raw()]; newElement_0.g = [NSNumber numberWithFloat:entry_0.g]; newElement_0.h = [NSNumber numberWithDouble:entry_0.h]; if (entry_0.i.HasValue()) { newElement_0.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.i.Value())]; } else { newElement_0.i = nil; } [array_0 addObject:newElement_0]; } params.arg1 = array_0; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testListStructArgumentRequestWithParams:params completion: ^(MTRUnitTestingClusterBooleanResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::BooleanResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::BooleanResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestListStructArgumentRequest::Type mRequest; TypedComplexArgument> mComplex_Arg1; }; /* * Command TestListInt8UArgumentRequest */ class UnitTestingTestListInt8UArgumentRequest : public ClusterCommand { public: UnitTestingTestListInt8UArgumentRequest() : ClusterCommand("test-list-int8uargument-request") , mComplex_Arg1(&mRequest.arg1) { AddArgument("Arg1", &mComplex_Arg1); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestListInt8UArgumentRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestListInt8UArgumentRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.arg1) { NSNumber * newElement_0; newElement_0 = [NSNumber numberWithUnsignedChar:entry_0]; [array_0 addObject:newElement_0]; } params.arg1 = array_0; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testListInt8UArgumentRequestWithParams:params completion: ^(MTRUnitTestingClusterBooleanResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::BooleanResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::BooleanResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestListInt8UArgumentRequest::Type mRequest; TypedComplexArgument> mComplex_Arg1; }; /* * Command TestNestedStructListArgumentRequest */ class UnitTestingTestNestedStructListArgumentRequest : public ClusterCommand { public: UnitTestingTestNestedStructListArgumentRequest() : ClusterCommand("test-nested-struct-list-argument-request") , mComplex_Arg1(&mRequest.arg1) { AddArgument("Arg1", &mComplex_Arg1); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestNestedStructListArgumentRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestNestedStructListArgumentRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.arg1 = [MTRUnitTestingClusterNestedStructList new]; params.arg1.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.a]; params.arg1.b = [NSNumber numberWithBool:mRequest.arg1.b]; params.arg1.c = [MTRUnitTestingClusterSimpleStruct new]; params.arg1.c.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.c.a]; params.arg1.c.b = [NSNumber numberWithBool:mRequest.arg1.c.b]; params.arg1.c.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.c.c)]; params.arg1.c.d = [NSData dataWithBytes:mRequest.arg1.c.d.data() length:mRequest.arg1.c.d.size()]; params.arg1.c.e = [[NSString alloc] initWithBytes:mRequest.arg1.c.e.data() length:mRequest.arg1.c.e.size() encoding:NSUTF8StringEncoding]; params.arg1.c.f = [NSNumber numberWithUnsignedChar:mRequest.arg1.c.f.Raw()]; params.arg1.c.g = [NSNumber numberWithFloat:mRequest.arg1.c.g]; params.arg1.c.h = [NSNumber numberWithDouble:mRequest.arg1.c.h]; if (mRequest.arg1.c.i.HasValue()) { params.arg1.c.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.c.i.Value())]; } else { params.arg1.c.i = nil; } { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.arg1.d) { MTRUnitTestingClusterSimpleStruct * newElement_1; newElement_1 = [MTRUnitTestingClusterSimpleStruct new]; newElement_1.a = [NSNumber numberWithUnsignedChar:entry_1.a]; newElement_1.b = [NSNumber numberWithBool:entry_1.b]; newElement_1.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1.c)]; newElement_1.d = [NSData dataWithBytes:entry_1.d.data() length:entry_1.d.size()]; newElement_1.e = [[NSString alloc] initWithBytes:entry_1.e.data() length:entry_1.e.size() encoding:NSUTF8StringEncoding]; newElement_1.f = [NSNumber numberWithUnsignedChar:entry_1.f.Raw()]; newElement_1.g = [NSNumber numberWithFloat:entry_1.g]; newElement_1.h = [NSNumber numberWithDouble:entry_1.h]; if (entry_1.i.HasValue()) { newElement_1.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1.i.Value())]; } else { newElement_1.i = nil; } [array_1 addObject:newElement_1]; } params.arg1.d = array_1; } { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.arg1.e) { NSNumber * newElement_1; newElement_1 = [NSNumber numberWithUnsignedInt:entry_1]; [array_1 addObject:newElement_1]; } params.arg1.e = array_1; } { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.arg1.f) { NSData * newElement_1; newElement_1 = [NSData dataWithBytes:entry_1.data() length:entry_1.size()]; [array_1 addObject:newElement_1]; } params.arg1.f = array_1; } { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.arg1.g) { NSNumber * newElement_1; newElement_1 = [NSNumber numberWithUnsignedChar:entry_1]; [array_1 addObject:newElement_1]; } params.arg1.g = array_1; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testNestedStructListArgumentRequestWithParams:params completion: ^(MTRUnitTestingClusterBooleanResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::BooleanResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::BooleanResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestNestedStructListArgumentRequest::Type mRequest; TypedComplexArgument mComplex_Arg1; }; /* * Command TestListNestedStructListArgumentRequest */ class UnitTestingTestListNestedStructListArgumentRequest : public ClusterCommand { public: UnitTestingTestListNestedStructListArgumentRequest() : ClusterCommand("test-list-nested-struct-list-argument-request") , mComplex_Arg1(&mRequest.arg1) { AddArgument("Arg1", &mComplex_Arg1); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestListNestedStructListArgumentRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestListNestedStructListArgumentRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.arg1) { MTRUnitTestingClusterNestedStructList * newElement_0; newElement_0 = [MTRUnitTestingClusterNestedStructList new]; newElement_0.a = [NSNumber numberWithUnsignedChar:entry_0.a]; newElement_0.b = [NSNumber numberWithBool:entry_0.b]; newElement_0.c = [MTRUnitTestingClusterSimpleStruct new]; newElement_0.c.a = [NSNumber numberWithUnsignedChar:entry_0.c.a]; newElement_0.c.b = [NSNumber numberWithBool:entry_0.c.b]; newElement_0.c.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c.c)]; newElement_0.c.d = [NSData dataWithBytes:entry_0.c.d.data() length:entry_0.c.d.size()]; newElement_0.c.e = [[NSString alloc] initWithBytes:entry_0.c.e.data() length:entry_0.c.e.size() encoding:NSUTF8StringEncoding]; newElement_0.c.f = [NSNumber numberWithUnsignedChar:entry_0.c.f.Raw()]; newElement_0.c.g = [NSNumber numberWithFloat:entry_0.c.g]; newElement_0.c.h = [NSNumber numberWithDouble:entry_0.c.h]; if (entry_0.c.i.HasValue()) { newElement_0.c.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c.i.Value())]; } else { newElement_0.c.i = nil; } { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.d) { MTRUnitTestingClusterSimpleStruct * newElement_2; newElement_2 = [MTRUnitTestingClusterSimpleStruct new]; newElement_2.a = [NSNumber numberWithUnsignedChar:entry_2.a]; newElement_2.b = [NSNumber numberWithBool:entry_2.b]; newElement_2.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.c)]; newElement_2.d = [NSData dataWithBytes:entry_2.d.data() length:entry_2.d.size()]; newElement_2.e = [[NSString alloc] initWithBytes:entry_2.e.data() length:entry_2.e.size() encoding:NSUTF8StringEncoding]; newElement_2.f = [NSNumber numberWithUnsignedChar:entry_2.f.Raw()]; newElement_2.g = [NSNumber numberWithFloat:entry_2.g]; newElement_2.h = [NSNumber numberWithDouble:entry_2.h]; if (entry_2.i.HasValue()) { newElement_2.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.i.Value())]; } else { newElement_2.i = nil; } [array_2 addObject:newElement_2]; } newElement_0.d = array_2; } { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.e) { NSNumber * newElement_2; newElement_2 = [NSNumber numberWithUnsignedInt:entry_2]; [array_2 addObject:newElement_2]; } newElement_0.e = array_2; } { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.f) { NSData * newElement_2; newElement_2 = [NSData dataWithBytes:entry_2.data() length:entry_2.size()]; [array_2 addObject:newElement_2]; } newElement_0.f = array_2; } { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.g) { NSNumber * newElement_2; newElement_2 = [NSNumber numberWithUnsignedChar:entry_2]; [array_2 addObject:newElement_2]; } newElement_0.g = array_2; } [array_0 addObject:newElement_0]; } params.arg1 = array_0; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testListNestedStructListArgumentRequestWithParams:params completion: ^(MTRUnitTestingClusterBooleanResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::BooleanResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::BooleanResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestListNestedStructListArgumentRequest::Type mRequest; TypedComplexArgument> mComplex_Arg1; }; /* * Command TestListInt8UReverseRequest */ class UnitTestingTestListInt8UReverseRequest : public ClusterCommand { public: UnitTestingTestListInt8UReverseRequest() : ClusterCommand("test-list-int8ureverse-request") , mComplex_Arg1(&mRequest.arg1) { AddArgument("Arg1", &mComplex_Arg1); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestListInt8UReverseRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestListInt8UReverseRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mRequest.arg1) { NSNumber * newElement_0; newElement_0 = [NSNumber numberWithUnsignedChar:entry_0]; [array_0 addObject:newElement_0]; } params.arg1 = array_0; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testListInt8UReverseRequestWithParams:params completion: ^(MTRUnitTestingClusterTestListInt8UReverseResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestListInt8UReverseResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestListInt8UReverseResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestListInt8UReverseRequest::Type mRequest; TypedComplexArgument> mComplex_Arg1; }; /* * Command TestEnumsRequest */ class UnitTestingTestEnumsRequest : public ClusterCommand { public: UnitTestingTestEnumsRequest() : ClusterCommand("test-enums-request") { AddArgument("Arg1", 0, UINT16_MAX, &mRequest.arg1); AddArgument("Arg2", 0, UINT8_MAX, &mRequest.arg2); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestEnumsRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestEnumsRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.arg1 = [NSNumber numberWithUnsignedShort:chip::to_underlying(mRequest.arg1)]; params.arg2 = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg2)]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testEnumsRequestWithParams:params completion: ^(MTRUnitTestingClusterTestEnumsResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestEnumsResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestEnumsResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestEnumsRequest::Type mRequest; }; /* * Command TestNullableOptionalRequest */ class UnitTestingTestNullableOptionalRequest : public ClusterCommand { public: UnitTestingTestNullableOptionalRequest() : ClusterCommand("test-nullable-optional-request") { AddArgument("Arg1", 0, UINT8_MAX, &mRequest.arg1); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestNullableOptionalRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestNullableOptionalRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; if (mRequest.arg1.HasValue()) { if (mRequest.arg1.Value().IsNull()) { params.arg1 = nil; } else { params.arg1 = [NSNumber numberWithUnsignedChar:mRequest.arg1.Value().Value()]; } } else { params.arg1 = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testNullableOptionalRequestWithParams:params completion: ^(MTRUnitTestingClusterTestNullableOptionalResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestNullableOptionalResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestNullableOptionalResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestNullableOptionalRequest::Type mRequest; }; /* * Command TestComplexNullableOptionalRequest */ class UnitTestingTestComplexNullableOptionalRequest : public ClusterCommand { public: UnitTestingTestComplexNullableOptionalRequest() : ClusterCommand("test-complex-nullable-optional-request") , mComplex_NullableStruct(&mRequest.nullableStruct) , mComplex_OptionalStruct(&mRequest.optionalStruct) , mComplex_NullableOptionalStruct(&mRequest.nullableOptionalStruct) , mComplex_NullableList(&mRequest.nullableList) , mComplex_OptionalList(&mRequest.optionalList) , mComplex_NullableOptionalList(&mRequest.nullableOptionalList) { AddArgument("NullableInt", 0, UINT16_MAX, &mRequest.nullableInt); AddArgument("OptionalInt", 0, UINT16_MAX, &mRequest.optionalInt); AddArgument("NullableOptionalInt", 0, UINT16_MAX, &mRequest.nullableOptionalInt); AddArgument("NullableString", &mRequest.nullableString); AddArgument("OptionalString", &mRequest.optionalString); AddArgument("NullableOptionalString", &mRequest.nullableOptionalString); AddArgument("NullableStruct", &mComplex_NullableStruct); AddArgument("OptionalStruct", &mComplex_OptionalStruct); AddArgument("NullableOptionalStruct", &mComplex_NullableOptionalStruct); AddArgument("NullableList", &mComplex_NullableList); AddArgument("OptionalList", &mComplex_OptionalList); AddArgument("NullableOptionalList", &mComplex_NullableOptionalList); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestComplexNullableOptionalRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestComplexNullableOptionalRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; if (mRequest.nullableInt.IsNull()) { params.nullableInt = nil; } else { params.nullableInt = [NSNumber numberWithUnsignedShort:mRequest.nullableInt.Value()]; } if (mRequest.optionalInt.HasValue()) { params.optionalInt = [NSNumber numberWithUnsignedShort:mRequest.optionalInt.Value()]; } else { params.optionalInt = nil; } if (mRequest.nullableOptionalInt.HasValue()) { if (mRequest.nullableOptionalInt.Value().IsNull()) { params.nullableOptionalInt = nil; } else { params.nullableOptionalInt = [NSNumber numberWithUnsignedShort:mRequest.nullableOptionalInt.Value().Value()]; } } else { params.nullableOptionalInt = nil; } if (mRequest.nullableString.IsNull()) { params.nullableString = nil; } else { params.nullableString = [[NSString alloc] initWithBytes:mRequest.nullableString.Value().data() length:mRequest.nullableString.Value().size() encoding:NSUTF8StringEncoding]; } if (mRequest.optionalString.HasValue()) { params.optionalString = [[NSString alloc] initWithBytes:mRequest.optionalString.Value().data() length:mRequest.optionalString.Value().size() encoding:NSUTF8StringEncoding]; } else { params.optionalString = nil; } if (mRequest.nullableOptionalString.HasValue()) { if (mRequest.nullableOptionalString.Value().IsNull()) { params.nullableOptionalString = nil; } else { params.nullableOptionalString = [[NSString alloc] initWithBytes:mRequest.nullableOptionalString.Value().Value().data() length:mRequest.nullableOptionalString.Value().Value().size() encoding:NSUTF8StringEncoding]; } } else { params.nullableOptionalString = nil; } if (mRequest.nullableStruct.IsNull()) { params.nullableStruct = nil; } else { params.nullableStruct = [MTRUnitTestingClusterSimpleStruct new]; params.nullableStruct.a = [NSNumber numberWithUnsignedChar:mRequest.nullableStruct.Value().a]; params.nullableStruct.b = [NSNumber numberWithBool:mRequest.nullableStruct.Value().b]; params.nullableStruct.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.nullableStruct.Value().c)]; params.nullableStruct.d = [NSData dataWithBytes:mRequest.nullableStruct.Value().d.data() length:mRequest.nullableStruct.Value().d.size()]; params.nullableStruct.e = [[NSString alloc] initWithBytes:mRequest.nullableStruct.Value().e.data() length:mRequest.nullableStruct.Value().e.size() encoding:NSUTF8StringEncoding]; params.nullableStruct.f = [NSNumber numberWithUnsignedChar:mRequest.nullableStruct.Value().f.Raw()]; params.nullableStruct.g = [NSNumber numberWithFloat:mRequest.nullableStruct.Value().g]; params.nullableStruct.h = [NSNumber numberWithDouble:mRequest.nullableStruct.Value().h]; if (mRequest.nullableStruct.Value().i.HasValue()) { params.nullableStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.nullableStruct.Value().i.Value())]; } else { params.nullableStruct.i = nil; } } if (mRequest.optionalStruct.HasValue()) { params.optionalStruct = [MTRUnitTestingClusterSimpleStruct new]; params.optionalStruct.a = [NSNumber numberWithUnsignedChar:mRequest.optionalStruct.Value().a]; params.optionalStruct.b = [NSNumber numberWithBool:mRequest.optionalStruct.Value().b]; params.optionalStruct.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.optionalStruct.Value().c)]; params.optionalStruct.d = [NSData dataWithBytes:mRequest.optionalStruct.Value().d.data() length:mRequest.optionalStruct.Value().d.size()]; params.optionalStruct.e = [[NSString alloc] initWithBytes:mRequest.optionalStruct.Value().e.data() length:mRequest.optionalStruct.Value().e.size() encoding:NSUTF8StringEncoding]; params.optionalStruct.f = [NSNumber numberWithUnsignedChar:mRequest.optionalStruct.Value().f.Raw()]; params.optionalStruct.g = [NSNumber numberWithFloat:mRequest.optionalStruct.Value().g]; params.optionalStruct.h = [NSNumber numberWithDouble:mRequest.optionalStruct.Value().h]; if (mRequest.optionalStruct.Value().i.HasValue()) { params.optionalStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.optionalStruct.Value().i.Value())]; } else { params.optionalStruct.i = nil; } } else { params.optionalStruct = nil; } if (mRequest.nullableOptionalStruct.HasValue()) { if (mRequest.nullableOptionalStruct.Value().IsNull()) { params.nullableOptionalStruct = nil; } else { params.nullableOptionalStruct = [MTRUnitTestingClusterSimpleStruct new]; params.nullableOptionalStruct.a = [NSNumber numberWithUnsignedChar:mRequest.nullableOptionalStruct.Value().Value().a]; params.nullableOptionalStruct.b = [NSNumber numberWithBool:mRequest.nullableOptionalStruct.Value().Value().b]; params.nullableOptionalStruct.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.nullableOptionalStruct.Value().Value().c)]; params.nullableOptionalStruct.d = [NSData dataWithBytes:mRequest.nullableOptionalStruct.Value().Value().d.data() length:mRequest.nullableOptionalStruct.Value().Value().d.size()]; params.nullableOptionalStruct.e = [[NSString alloc] initWithBytes:mRequest.nullableOptionalStruct.Value().Value().e.data() length:mRequest.nullableOptionalStruct.Value().Value().e.size() encoding:NSUTF8StringEncoding]; params.nullableOptionalStruct.f = [NSNumber numberWithUnsignedChar:mRequest.nullableOptionalStruct.Value().Value().f.Raw()]; params.nullableOptionalStruct.g = [NSNumber numberWithFloat:mRequest.nullableOptionalStruct.Value().Value().g]; params.nullableOptionalStruct.h = [NSNumber numberWithDouble:mRequest.nullableOptionalStruct.Value().Value().h]; if (mRequest.nullableOptionalStruct.Value().Value().i.HasValue()) { params.nullableOptionalStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.nullableOptionalStruct.Value().Value().i.Value())]; } else { params.nullableOptionalStruct.i = nil; } } } else { params.nullableOptionalStruct = nil; } if (mRequest.nullableList.IsNull()) { params.nullableList = nil; } else { { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.nullableList.Value()) { NSNumber * newElement_1; newElement_1 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1)]; [array_1 addObject:newElement_1]; } params.nullableList = array_1; } } if (mRequest.optionalList.HasValue()) { { // Scope for our temporary variables auto * array_1 = [NSMutableArray new]; for (auto & entry_1 : mRequest.optionalList.Value()) { NSNumber * newElement_1; newElement_1 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_1)]; [array_1 addObject:newElement_1]; } params.optionalList = array_1; } } else { params.optionalList = nil; } if (mRequest.nullableOptionalList.HasValue()) { if (mRequest.nullableOptionalList.Value().IsNull()) { params.nullableOptionalList = nil; } else { { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : mRequest.nullableOptionalList.Value().Value()) { NSNumber * newElement_2; newElement_2 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2)]; [array_2 addObject:newElement_2]; } params.nullableOptionalList = array_2; } } } else { params.nullableOptionalList = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testComplexNullableOptionalRequestWithParams:params completion: ^(MTRUnitTestingClusterTestComplexNullableOptionalResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestComplexNullableOptionalResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestComplexNullableOptionalResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestComplexNullableOptionalRequest::Type mRequest; TypedComplexArgument> mComplex_NullableStruct; TypedComplexArgument> mComplex_OptionalStruct; TypedComplexArgument>> mComplex_NullableOptionalStruct; TypedComplexArgument>> mComplex_NullableList; TypedComplexArgument>> mComplex_OptionalList; TypedComplexArgument>>> mComplex_NullableOptionalList; }; /* * Command SimpleStructEchoRequest */ class UnitTestingSimpleStructEchoRequest : public ClusterCommand { public: UnitTestingSimpleStructEchoRequest() : ClusterCommand("simple-struct-echo-request") , mComplex_Arg1(&mRequest.arg1) { AddArgument("Arg1", &mComplex_Arg1); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::SimpleStructEchoRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterSimpleStructEchoRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.arg1 = [MTRUnitTestingClusterSimpleStruct new]; params.arg1.a = [NSNumber numberWithUnsignedChar:mRequest.arg1.a]; params.arg1.b = [NSNumber numberWithBool:mRequest.arg1.b]; params.arg1.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.c)]; params.arg1.d = [NSData dataWithBytes:mRequest.arg1.d.data() length:mRequest.arg1.d.size()]; params.arg1.e = [[NSString alloc] initWithBytes:mRequest.arg1.e.data() length:mRequest.arg1.e.size() encoding:NSUTF8StringEncoding]; params.arg1.f = [NSNumber numberWithUnsignedChar:mRequest.arg1.f.Raw()]; params.arg1.g = [NSNumber numberWithFloat:mRequest.arg1.g]; params.arg1.h = [NSNumber numberWithDouble:mRequest.arg1.h]; if (mRequest.arg1.i.HasValue()) { params.arg1.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg1.i.Value())]; } else { params.arg1.i = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster simpleStructEchoRequestWithParams:params completion: ^(MTRUnitTestingClusterSimpleStructResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::SimpleStructResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::SimpleStructResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::SimpleStructEchoRequest::Type mRequest; TypedComplexArgument mComplex_Arg1; }; /* * Command TimedInvokeRequest */ class UnitTestingTimedInvokeRequest : public ClusterCommand { public: UnitTestingTimedInvokeRequest() : ClusterCommand("timed-invoke-request") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TimedInvokeRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTimedInvokeRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster timedInvokeRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; /* * Command TestSimpleOptionalArgumentRequest */ class UnitTestingTestSimpleOptionalArgumentRequest : public ClusterCommand { public: UnitTestingTestSimpleOptionalArgumentRequest() : ClusterCommand("test-simple-optional-argument-request") { AddArgument("Arg1", 0, 1, &mRequest.arg1); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestSimpleOptionalArgumentRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestSimpleOptionalArgumentRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; if (mRequest.arg1.HasValue()) { params.arg1 = [NSNumber numberWithBool:mRequest.arg1.Value()]; } else { params.arg1 = nil; } uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testSimpleOptionalArgumentRequestWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestSimpleOptionalArgumentRequest::Type mRequest; }; /* * Command TestEmitTestEventRequest */ class UnitTestingTestEmitTestEventRequest : public ClusterCommand { public: UnitTestingTestEmitTestEventRequest() : ClusterCommand("test-emit-test-event-request") { AddArgument("Arg1", 0, UINT8_MAX, &mRequest.arg1); AddArgument("Arg2", 0, UINT8_MAX, &mRequest.arg2); AddArgument("Arg3", 0, 1, &mRequest.arg3); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestEmitTestEventRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestEmitTestEventRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.arg1 = [NSNumber numberWithUnsignedChar:mRequest.arg1]; params.arg2 = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.arg2)]; params.arg3 = [NSNumber numberWithBool:mRequest.arg3]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testEmitTestEventRequestWithParams:params completion: ^(MTRUnitTestingClusterTestEmitTestEventResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestEmitTestEventResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestEmitTestEventResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestEmitTestEventRequest::Type mRequest; }; /* * Command TestEmitTestFabricScopedEventRequest */ class UnitTestingTestEmitTestFabricScopedEventRequest : public ClusterCommand { public: UnitTestingTestEmitTestFabricScopedEventRequest() : ClusterCommand("test-emit-test-fabric-scoped-event-request") { AddArgument("Arg1", 0, UINT8_MAX, &mRequest.arg1); ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestEmitTestFabricScopedEventRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestEmitTestFabricScopedEventRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.arg1 = [NSNumber numberWithUnsignedChar:mRequest.arg1]; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testEmitTestFabricScopedEventRequestWithParams:params completion: ^(MTRUnitTestingClusterTestEmitTestFabricScopedEventResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestEmitTestFabricScopedEventResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestEmitTestFabricScopedEventResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestEmitTestFabricScopedEventRequest::Type mRequest; }; #if MTR_ENABLE_PROVISIONAL /* * Command TestBatchHelperRequest */ class UnitTestingTestBatchHelperRequest : public ClusterCommand { public: UnitTestingTestBatchHelperRequest() : ClusterCommand("test-batch-helper-request") { #if MTR_ENABLE_PROVISIONAL AddArgument("SleepBeforeResponseTimeMs", 0, UINT16_MAX, &mRequest.sleepBeforeResponseTimeMs); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("SizeOfResponseBuffer", 0, UINT16_MAX, &mRequest.sizeOfResponseBuffer); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("FillCharacter", 0, UINT8_MAX, &mRequest.fillCharacter); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestBatchHelperRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestBatchHelperRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.sleepBeforeResponseTimeMs = [NSNumber numberWithUnsignedShort:mRequest.sleepBeforeResponseTimeMs]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.sizeOfResponseBuffer = [NSNumber numberWithUnsignedShort:mRequest.sizeOfResponseBuffer]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.fillCharacter = [NSNumber numberWithUnsignedChar:mRequest.fillCharacter]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testBatchHelperRequestWithParams:params completion: ^(MTRUnitTestingClusterTestBatchHelperResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestBatchHelperResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestBatchHelperResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestBatchHelperRequest::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command TestSecondBatchHelperRequest */ class UnitTestingTestSecondBatchHelperRequest : public ClusterCommand { public: UnitTestingTestSecondBatchHelperRequest() : ClusterCommand("test-second-batch-helper-request") { #if MTR_ENABLE_PROVISIONAL AddArgument("SleepBeforeResponseTimeMs", 0, UINT16_MAX, &mRequest.sleepBeforeResponseTimeMs); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("SizeOfResponseBuffer", 0, UINT16_MAX, &mRequest.sizeOfResponseBuffer); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("FillCharacter", 0, UINT8_MAX, &mRequest.fillCharacter); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestSecondBatchHelperRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestSecondBatchHelperRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.sleepBeforeResponseTimeMs = [NSNumber numberWithUnsignedShort:mRequest.sleepBeforeResponseTimeMs]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.sizeOfResponseBuffer = [NSNumber numberWithUnsignedShort:mRequest.sizeOfResponseBuffer]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.fillCharacter = [NSNumber numberWithUnsignedChar:mRequest.fillCharacter]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testSecondBatchHelperRequestWithParams:params completion: ^(MTRUnitTestingClusterTestBatchHelperResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestBatchHelperResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestBatchHelperResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestSecondBatchHelperRequest::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command StringEchoRequest */ class UnitTestingStringEchoRequest : public ClusterCommand { public: UnitTestingStringEchoRequest() : ClusterCommand("string-echo-request") { #if MTR_ENABLE_PROVISIONAL AddArgument("Payload", &mRequest.payload); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::StringEchoRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterStringEchoRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.payload = [NSData dataWithBytes:mRequest.payload.data() length:mRequest.payload.size()]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster stringEchoRequestWithParams:params completion: ^(MTRUnitTestingClusterStringEchoResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::StringEchoResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::StringEchoResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::StringEchoRequest::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command GlobalEchoRequest */ class UnitTestingGlobalEchoRequest : public ClusterCommand { public: UnitTestingGlobalEchoRequest() : ClusterCommand("global-echo-request") , mComplex_Field1(&mRequest.field1) { #if MTR_ENABLE_PROVISIONAL AddArgument("Field1", &mComplex_Field1); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Field2", 0, UINT8_MAX, &mRequest.field2); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::GlobalEchoRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterGlobalEchoRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.field1 = [MTRDataTypeTestGlobalStruct new]; params.field1.name = [[NSString alloc] initWithBytes:mRequest.field1.name.data() length:mRequest.field1.name.size() encoding:NSUTF8StringEncoding]; if (mRequest.field1.myBitmap.IsNull()) { params.field1.myBitmap = nil; } else { params.field1.myBitmap = [NSNumber numberWithUnsignedInt:mRequest.field1.myBitmap.Value().Raw()]; } if (mRequest.field1.myEnum.HasValue()) { if (mRequest.field1.myEnum.Value().IsNull()) { params.field1.myEnum = nil; } else { params.field1.myEnum = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.field1.myEnum.Value().Value())]; } } else { params.field1.myEnum = nil; } #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.field2 = [NSNumber numberWithUnsignedChar:chip::to_underlying(mRequest.field2)]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster globalEchoRequestWithParams:params completion: ^(MTRUnitTestingClusterGlobalEchoResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::GlobalEchoResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::GlobalEchoResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::GlobalEchoRequest::Type mRequest; TypedComplexArgument mComplex_Field1; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command TestDifferentVendorMeiRequest */ class UnitTestingTestDifferentVendorMeiRequest : public ClusterCommand { public: UnitTestingTestDifferentVendorMeiRequest() : ClusterCommand("test-different-vendor-mei-request") { #if MTR_ENABLE_PROVISIONAL AddArgument("Arg1", 0, UINT8_MAX, &mRequest.arg1); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId commandId = chip::app::Clusters::UnitTesting::Commands::TestDifferentVendorMeiRequest::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRUnitTestingClusterTestDifferentVendorMeiRequestParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.arg1 = [NSNumber numberWithUnsignedChar:mRequest.arg1]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster testDifferentVendorMeiRequestWithParams:params completion: ^(MTRUnitTestingClusterTestDifferentVendorMeiResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestDifferentVendorMeiResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::UnitTesting::Commands::TestDifferentVendorMeiResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Commands::TestDifferentVendorMeiRequest::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute Boolean */ class ReadUnitTestingBoolean : public ReadAttribute { public: ReadUnitTestingBoolean() : ReadAttribute("boolean") { } ~ReadUnitTestingBoolean() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Boolean::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBooleanWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Boolean response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Boolean read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingBoolean : public WriteAttribute { public: WriteUnitTestingBoolean() : WriteAttribute("boolean") { AddArgument("attr-name", "boolean"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingBoolean() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Boolean::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeBooleanWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Boolean write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeUnitTestingBoolean : public SubscribeAttribute { public: SubscribeAttributeUnitTestingBoolean() : SubscribeAttribute("boolean") { } ~SubscribeAttributeUnitTestingBoolean() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Boolean::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBooleanWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Boolean response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Bitmap8 */ class ReadUnitTestingBitmap8 : public ReadAttribute { public: ReadUnitTestingBitmap8() : ReadAttribute("bitmap8") { } ~ReadUnitTestingBitmap8() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Bitmap8::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBitmap8WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Bitmap8 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Bitmap8 read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingBitmap8 : public WriteAttribute { public: WriteUnitTestingBitmap8() : WriteAttribute("bitmap8") { AddArgument("attr-name", "bitmap8"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingBitmap8() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Bitmap8::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeBitmap8WithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Bitmap8 write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeUnitTestingBitmap8 : public SubscribeAttribute { public: SubscribeAttributeUnitTestingBitmap8() : SubscribeAttribute("bitmap8") { } ~SubscribeAttributeUnitTestingBitmap8() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Bitmap8::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBitmap8WithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Bitmap8 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Bitmap16 */ class ReadUnitTestingBitmap16 : public ReadAttribute { public: ReadUnitTestingBitmap16() : ReadAttribute("bitmap16") { } ~ReadUnitTestingBitmap16() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Bitmap16::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBitmap16WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Bitmap16 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Bitmap16 read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingBitmap16 : public WriteAttribute { public: WriteUnitTestingBitmap16() : WriteAttribute("bitmap16") { AddArgument("attr-name", "bitmap16"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingBitmap16() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Bitmap16::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeBitmap16WithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Bitmap16 write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeUnitTestingBitmap16 : public SubscribeAttribute { public: SubscribeAttributeUnitTestingBitmap16() : SubscribeAttribute("bitmap16") { } ~SubscribeAttributeUnitTestingBitmap16() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Bitmap16::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBitmap16WithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Bitmap16 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Bitmap32 */ class ReadUnitTestingBitmap32 : public ReadAttribute { public: ReadUnitTestingBitmap32() : ReadAttribute("bitmap32") { } ~ReadUnitTestingBitmap32() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Bitmap32::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBitmap32WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Bitmap32 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Bitmap32 read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingBitmap32 : public WriteAttribute { public: WriteUnitTestingBitmap32() : WriteAttribute("bitmap32") { AddArgument("attr-name", "bitmap32"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingBitmap32() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Bitmap32::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; [cluster writeAttributeBitmap32WithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Bitmap32 write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint32_t mValue; }; class SubscribeAttributeUnitTestingBitmap32 : public SubscribeAttribute { public: SubscribeAttributeUnitTestingBitmap32() : SubscribeAttribute("bitmap32") { } ~SubscribeAttributeUnitTestingBitmap32() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Bitmap32::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBitmap32WithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Bitmap32 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Bitmap64 */ class ReadUnitTestingBitmap64 : public ReadAttribute { public: ReadUnitTestingBitmap64() : ReadAttribute("bitmap64") { } ~ReadUnitTestingBitmap64() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Bitmap64::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeBitmap64WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Bitmap64 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Bitmap64 read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingBitmap64 : public WriteAttribute { public: WriteUnitTestingBitmap64() : WriteAttribute("bitmap64") { AddArgument("attr-name", "bitmap64"); AddArgument("attr-value", 0, UINT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingBitmap64() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Bitmap64::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; [cluster writeAttributeBitmap64WithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Bitmap64 write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint64_t mValue; }; class SubscribeAttributeUnitTestingBitmap64 : public SubscribeAttribute { public: SubscribeAttributeUnitTestingBitmap64() : SubscribeAttribute("bitmap64") { } ~SubscribeAttributeUnitTestingBitmap64() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Bitmap64::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeBitmap64WithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Bitmap64 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Int8u */ class ReadUnitTestingInt8u : public ReadAttribute { public: ReadUnitTestingInt8u() : ReadAttribute("int8u") { } ~ReadUnitTestingInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInt8uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int8u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Int8u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingInt8u : public WriteAttribute { public: WriteUnitTestingInt8u() : WriteAttribute("int8u") { AddArgument("attr-name", "int8u"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeInt8uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Int8u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeUnitTestingInt8u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingInt8u() : SubscribeAttribute("int8u") { } ~SubscribeAttributeUnitTestingInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInt8uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int8u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Int16u */ class ReadUnitTestingInt16u : public ReadAttribute { public: ReadUnitTestingInt16u() : ReadAttribute("int16u") { } ~ReadUnitTestingInt16u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int16u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInt16uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int16u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Int16u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingInt16u : public WriteAttribute { public: WriteUnitTestingInt16u() : WriteAttribute("int16u") { AddArgument("attr-name", "int16u"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingInt16u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int16u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeInt16uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Int16u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeUnitTestingInt16u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingInt16u() : SubscribeAttribute("int16u") { } ~SubscribeAttributeUnitTestingInt16u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int16u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInt16uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int16u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Int24u */ class ReadUnitTestingInt24u : public ReadAttribute { public: ReadUnitTestingInt24u() : ReadAttribute("int24u") { } ~ReadUnitTestingInt24u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int24u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInt24uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int24u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Int24u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingInt24u : public WriteAttribute { public: WriteUnitTestingInt24u() : WriteAttribute("int24u") { AddArgument("attr-name", "int24u"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingInt24u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int24u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; [cluster writeAttributeInt24uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Int24u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint32_t mValue; }; class SubscribeAttributeUnitTestingInt24u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingInt24u() : SubscribeAttribute("int24u") { } ~SubscribeAttributeUnitTestingInt24u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int24u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInt24uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int24u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Int32u */ class ReadUnitTestingInt32u : public ReadAttribute { public: ReadUnitTestingInt32u() : ReadAttribute("int32u") { } ~ReadUnitTestingInt32u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int32u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInt32uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int32u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Int32u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingInt32u : public WriteAttribute { public: WriteUnitTestingInt32u() : WriteAttribute("int32u") { AddArgument("attr-name", "int32u"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingInt32u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int32u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; [cluster writeAttributeInt32uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Int32u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint32_t mValue; }; class SubscribeAttributeUnitTestingInt32u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingInt32u() : SubscribeAttribute("int32u") { } ~SubscribeAttributeUnitTestingInt32u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int32u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInt32uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int32u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Int40u */ class ReadUnitTestingInt40u : public ReadAttribute { public: ReadUnitTestingInt40u() : ReadAttribute("int40u") { } ~ReadUnitTestingInt40u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int40u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInt40uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int40u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Int40u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingInt40u : public WriteAttribute { public: WriteUnitTestingInt40u() : WriteAttribute("int40u") { AddArgument("attr-name", "int40u"); AddArgument("attr-value", 0, UINT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingInt40u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int40u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; [cluster writeAttributeInt40uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Int40u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint64_t mValue; }; class SubscribeAttributeUnitTestingInt40u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingInt40u() : SubscribeAttribute("int40u") { } ~SubscribeAttributeUnitTestingInt40u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int40u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInt40uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int40u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Int48u */ class ReadUnitTestingInt48u : public ReadAttribute { public: ReadUnitTestingInt48u() : ReadAttribute("int48u") { } ~ReadUnitTestingInt48u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int48u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInt48uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int48u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Int48u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingInt48u : public WriteAttribute { public: WriteUnitTestingInt48u() : WriteAttribute("int48u") { AddArgument("attr-name", "int48u"); AddArgument("attr-value", 0, UINT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingInt48u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int48u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; [cluster writeAttributeInt48uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Int48u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint64_t mValue; }; class SubscribeAttributeUnitTestingInt48u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingInt48u() : SubscribeAttribute("int48u") { } ~SubscribeAttributeUnitTestingInt48u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int48u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInt48uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int48u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Int56u */ class ReadUnitTestingInt56u : public ReadAttribute { public: ReadUnitTestingInt56u() : ReadAttribute("int56u") { } ~ReadUnitTestingInt56u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int56u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInt56uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int56u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Int56u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingInt56u : public WriteAttribute { public: WriteUnitTestingInt56u() : WriteAttribute("int56u") { AddArgument("attr-name", "int56u"); AddArgument("attr-value", 0, UINT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingInt56u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int56u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; [cluster writeAttributeInt56uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Int56u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint64_t mValue; }; class SubscribeAttributeUnitTestingInt56u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingInt56u() : SubscribeAttribute("int56u") { } ~SubscribeAttributeUnitTestingInt56u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int56u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInt56uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int56u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Int64u */ class ReadUnitTestingInt64u : public ReadAttribute { public: ReadUnitTestingInt64u() : ReadAttribute("int64u") { } ~ReadUnitTestingInt64u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int64u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInt64uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int64u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Int64u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingInt64u : public WriteAttribute { public: WriteUnitTestingInt64u() : WriteAttribute("int64u") { AddArgument("attr-name", "int64u"); AddArgument("attr-value", 0, UINT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingInt64u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int64u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; [cluster writeAttributeInt64uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Int64u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint64_t mValue; }; class SubscribeAttributeUnitTestingInt64u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingInt64u() : SubscribeAttribute("int64u") { } ~SubscribeAttributeUnitTestingInt64u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int64u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInt64uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int64u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Int8s */ class ReadUnitTestingInt8s : public ReadAttribute { public: ReadUnitTestingInt8s() : ReadAttribute("int8s") { } ~ReadUnitTestingInt8s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int8s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInt8sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int8s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Int8s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingInt8s : public WriteAttribute { public: WriteUnitTestingInt8s() : WriteAttribute("int8s") { AddArgument("attr-name", "int8s"); AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingInt8s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int8s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithChar:mValue]; [cluster writeAttributeInt8sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Int8s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int8_t mValue; }; class SubscribeAttributeUnitTestingInt8s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingInt8s() : SubscribeAttribute("int8s") { } ~SubscribeAttributeUnitTestingInt8s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int8s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInt8sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int8s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Int16s */ class ReadUnitTestingInt16s : public ReadAttribute { public: ReadUnitTestingInt16s() : ReadAttribute("int16s") { } ~ReadUnitTestingInt16s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int16s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInt16sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int16s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Int16s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingInt16s : public WriteAttribute { public: WriteUnitTestingInt16s() : WriteAttribute("int16s") { AddArgument("attr-name", "int16s"); AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingInt16s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int16s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; [cluster writeAttributeInt16sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Int16s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int16_t mValue; }; class SubscribeAttributeUnitTestingInt16s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingInt16s() : SubscribeAttribute("int16s") { } ~SubscribeAttributeUnitTestingInt16s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int16s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInt16sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int16s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Int24s */ class ReadUnitTestingInt24s : public ReadAttribute { public: ReadUnitTestingInt24s() : ReadAttribute("int24s") { } ~ReadUnitTestingInt24s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int24s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInt24sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int24s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Int24s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingInt24s : public WriteAttribute { public: WriteUnitTestingInt24s() : WriteAttribute("int24s") { AddArgument("attr-name", "int24s"); AddArgument("attr-value", INT32_MIN, INT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingInt24s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int24s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithInt:mValue]; [cluster writeAttributeInt24sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Int24s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int32_t mValue; }; class SubscribeAttributeUnitTestingInt24s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingInt24s() : SubscribeAttribute("int24s") { } ~SubscribeAttributeUnitTestingInt24s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int24s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInt24sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int24s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Int32s */ class ReadUnitTestingInt32s : public ReadAttribute { public: ReadUnitTestingInt32s() : ReadAttribute("int32s") { } ~ReadUnitTestingInt32s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int32s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInt32sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int32s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Int32s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingInt32s : public WriteAttribute { public: WriteUnitTestingInt32s() : WriteAttribute("int32s") { AddArgument("attr-name", "int32s"); AddArgument("attr-value", INT32_MIN, INT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingInt32s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int32s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithInt:mValue]; [cluster writeAttributeInt32sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Int32s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int32_t mValue; }; class SubscribeAttributeUnitTestingInt32s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingInt32s() : SubscribeAttribute("int32s") { } ~SubscribeAttributeUnitTestingInt32s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int32s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInt32sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int32s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Int40s */ class ReadUnitTestingInt40s : public ReadAttribute { public: ReadUnitTestingInt40s() : ReadAttribute("int40s") { } ~ReadUnitTestingInt40s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int40s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInt40sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int40s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Int40s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingInt40s : public WriteAttribute { public: WriteUnitTestingInt40s() : WriteAttribute("int40s") { AddArgument("attr-name", "int40s"); AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingInt40s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int40s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithLongLong:mValue]; [cluster writeAttributeInt40sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Int40s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int64_t mValue; }; class SubscribeAttributeUnitTestingInt40s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingInt40s() : SubscribeAttribute("int40s") { } ~SubscribeAttributeUnitTestingInt40s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int40s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInt40sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int40s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Int48s */ class ReadUnitTestingInt48s : public ReadAttribute { public: ReadUnitTestingInt48s() : ReadAttribute("int48s") { } ~ReadUnitTestingInt48s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int48s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInt48sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int48s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Int48s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingInt48s : public WriteAttribute { public: WriteUnitTestingInt48s() : WriteAttribute("int48s") { AddArgument("attr-name", "int48s"); AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingInt48s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int48s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithLongLong:mValue]; [cluster writeAttributeInt48sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Int48s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int64_t mValue; }; class SubscribeAttributeUnitTestingInt48s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingInt48s() : SubscribeAttribute("int48s") { } ~SubscribeAttributeUnitTestingInt48s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int48s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInt48sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int48s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Int56s */ class ReadUnitTestingInt56s : public ReadAttribute { public: ReadUnitTestingInt56s() : ReadAttribute("int56s") { } ~ReadUnitTestingInt56s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int56s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInt56sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int56s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Int56s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingInt56s : public WriteAttribute { public: WriteUnitTestingInt56s() : WriteAttribute("int56s") { AddArgument("attr-name", "int56s"); AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingInt56s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int56s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithLongLong:mValue]; [cluster writeAttributeInt56sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Int56s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int64_t mValue; }; class SubscribeAttributeUnitTestingInt56s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingInt56s() : SubscribeAttribute("int56s") { } ~SubscribeAttributeUnitTestingInt56s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int56s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInt56sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int56s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Int64s */ class ReadUnitTestingInt64s : public ReadAttribute { public: ReadUnitTestingInt64s() : ReadAttribute("int64s") { } ~ReadUnitTestingInt64s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int64s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeInt64sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int64s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Int64s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingInt64s : public WriteAttribute { public: WriteUnitTestingInt64s() : WriteAttribute("int64s") { AddArgument("attr-name", "int64s"); AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingInt64s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int64s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithLongLong:mValue]; [cluster writeAttributeInt64sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Int64s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int64_t mValue; }; class SubscribeAttributeUnitTestingInt64s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingInt64s() : SubscribeAttribute("int64s") { } ~SubscribeAttributeUnitTestingInt64s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Int64s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeInt64sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Int64s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Enum8 */ class ReadUnitTestingEnum8 : public ReadAttribute { public: ReadUnitTestingEnum8() : ReadAttribute("enum8") { } ~ReadUnitTestingEnum8() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Enum8::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEnum8WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Enum8 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Enum8 read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingEnum8 : public WriteAttribute { public: WriteUnitTestingEnum8() : WriteAttribute("enum8") { AddArgument("attr-name", "enum8"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingEnum8() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Enum8::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeEnum8WithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Enum8 write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeUnitTestingEnum8 : public SubscribeAttribute { public: SubscribeAttributeUnitTestingEnum8() : SubscribeAttribute("enum8") { } ~SubscribeAttributeUnitTestingEnum8() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Enum8::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEnum8WithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Enum8 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute Enum16 */ class ReadUnitTestingEnum16 : public ReadAttribute { public: ReadUnitTestingEnum16() : ReadAttribute("enum16") { } ~ReadUnitTestingEnum16() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Enum16::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEnum16WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Enum16 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Enum16 read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingEnum16 : public WriteAttribute { public: WriteUnitTestingEnum16() : WriteAttribute("enum16") { AddArgument("attr-name", "enum16"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingEnum16() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Enum16::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeEnum16WithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Enum16 write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeUnitTestingEnum16 : public SubscribeAttribute { public: SubscribeAttributeUnitTestingEnum16() : SubscribeAttribute("enum16") { } ~SubscribeAttributeUnitTestingEnum16() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Enum16::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEnum16WithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Enum16 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FloatSingle */ class ReadUnitTestingFloatSingle : public ReadAttribute { public: ReadUnitTestingFloatSingle() : ReadAttribute("float-single") { } ~ReadUnitTestingFloatSingle() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::FloatSingle::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFloatSingleWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.FloatSingle response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting FloatSingle read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingFloatSingle : public WriteAttribute { public: WriteUnitTestingFloatSingle() : WriteAttribute("float-single") { AddArgument("attr-name", "float-single"); AddArgument("attr-value", -std::numeric_limits::infinity(), std::numeric_limits::infinity(), &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingFloatSingle() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::FloatSingle::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithFloat:mValue]; [cluster writeAttributeFloatSingleWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting FloatSingle write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: float mValue; }; class SubscribeAttributeUnitTestingFloatSingle : public SubscribeAttribute { public: SubscribeAttributeUnitTestingFloatSingle() : SubscribeAttribute("float-single") { } ~SubscribeAttributeUnitTestingFloatSingle() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::FloatSingle::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFloatSingleWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.FloatSingle response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FloatDouble */ class ReadUnitTestingFloatDouble : public ReadAttribute { public: ReadUnitTestingFloatDouble() : ReadAttribute("float-double") { } ~ReadUnitTestingFloatDouble() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::FloatDouble::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFloatDoubleWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.FloatDouble response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting FloatDouble read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingFloatDouble : public WriteAttribute { public: WriteUnitTestingFloatDouble() : WriteAttribute("float-double") { AddArgument("attr-name", "float-double"); AddArgument("attr-value", -std::numeric_limits::infinity(), std::numeric_limits::infinity(), &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingFloatDouble() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::FloatDouble::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithDouble:mValue]; [cluster writeAttributeFloatDoubleWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting FloatDouble write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: double mValue; }; class SubscribeAttributeUnitTestingFloatDouble : public SubscribeAttribute { public: SubscribeAttributeUnitTestingFloatDouble() : SubscribeAttribute("float-double") { } ~SubscribeAttributeUnitTestingFloatDouble() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::FloatDouble::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFloatDoubleWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.FloatDouble response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute OctetString */ class ReadUnitTestingOctetString : public ReadAttribute { public: ReadUnitTestingOctetString() : ReadAttribute("octet-string") { } ~ReadUnitTestingOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::OctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeOctetStringWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.OctetString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting OctetString read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingOctetString : public WriteAttribute { public: WriteUnitTestingOctetString() : WriteAttribute("octet-string") { AddArgument("attr-name", "octet-string"); AddArgument("attr-value", &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::OctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSData * _Nonnull value = [[NSData alloc] initWithBytes:mValue.data() length:mValue.size()]; [cluster writeAttributeOctetStringWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting OctetString write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::ByteSpan mValue; }; class SubscribeAttributeUnitTestingOctetString : public SubscribeAttribute { public: SubscribeAttributeUnitTestingOctetString() : SubscribeAttribute("octet-string") { } ~SubscribeAttributeUnitTestingOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::OctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeOctetStringWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.OctetString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ListInt8u */ class ReadUnitTestingListInt8u : public ReadAttribute { public: ReadUnitTestingListInt8u() : ReadAttribute("list-int8u") { } ~ReadUnitTestingListInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeListInt8uWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ListInt8u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting ListInt8u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingListInt8u : public WriteAttribute { public: WriteUnitTestingListInt8u() : WriteAttribute("list-int8u") , mComplex(&mValue) { AddArgument("attr-name", "list-int8u"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteUnitTestingListInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSArray * _Nonnull value; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { NSNumber * newElement_0; newElement_0 = [NSNumber numberWithUnsignedChar:entry_0]; [array_0 addObject:newElement_0]; } value = array_0; } [cluster writeAttributeListInt8uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting ListInt8u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::List mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeUnitTestingListInt8u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingListInt8u() : SubscribeAttribute("list-int8u") { } ~SubscribeAttributeUnitTestingListInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeListInt8uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ListInt8u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ListOctetString */ class ReadUnitTestingListOctetString : public ReadAttribute { public: ReadUnitTestingListOctetString() : ReadAttribute("list-octet-string") { } ~ReadUnitTestingListOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListOctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeListOctetStringWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ListOctetString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting ListOctetString read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingListOctetString : public WriteAttribute { public: WriteUnitTestingListOctetString() : WriteAttribute("list-octet-string") , mComplex(&mValue) { AddArgument("attr-name", "list-octet-string"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteUnitTestingListOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListOctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSArray * _Nonnull value; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { NSData * newElement_0; newElement_0 = [NSData dataWithBytes:entry_0.data() length:entry_0.size()]; [array_0 addObject:newElement_0]; } value = array_0; } [cluster writeAttributeListOctetStringWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting ListOctetString write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::List mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeUnitTestingListOctetString : public SubscribeAttribute { public: SubscribeAttributeUnitTestingListOctetString() : SubscribeAttribute("list-octet-string") { } ~SubscribeAttributeUnitTestingListOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListOctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeListOctetStringWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ListOctetString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ListStructOctetString */ class ReadUnitTestingListStructOctetString : public ReadAttribute { public: ReadUnitTestingListStructOctetString() : ReadAttribute("list-struct-octet-string") { } ~ReadUnitTestingListStructOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListStructOctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeListStructOctetStringWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ListStructOctetString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting ListStructOctetString read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingListStructOctetString : public WriteAttribute { public: WriteUnitTestingListStructOctetString() : WriteAttribute("list-struct-octet-string") , mComplex(&mValue) { AddArgument("attr-name", "list-struct-octet-string"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteUnitTestingListStructOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListStructOctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSArray * _Nonnull value; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { MTRUnitTestingClusterTestListStructOctet * newElement_0; newElement_0 = [MTRUnitTestingClusterTestListStructOctet new]; newElement_0.member1 = [NSNumber numberWithUnsignedLongLong:entry_0.member1]; newElement_0.member2 = [NSData dataWithBytes:entry_0.member2.data() length:entry_0.member2.size()]; [array_0 addObject:newElement_0]; } value = array_0; } [cluster writeAttributeListStructOctetStringWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting ListStructOctetString write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::List mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeUnitTestingListStructOctetString : public SubscribeAttribute { public: SubscribeAttributeUnitTestingListStructOctetString() : SubscribeAttribute("list-struct-octet-string") { } ~SubscribeAttributeUnitTestingListStructOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListStructOctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeListStructOctetStringWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ListStructOctetString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LongOctetString */ class ReadUnitTestingLongOctetString : public ReadAttribute { public: ReadUnitTestingLongOctetString() : ReadAttribute("long-octet-string") { } ~ReadUnitTestingLongOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::LongOctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLongOctetStringWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.LongOctetString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting LongOctetString read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingLongOctetString : public WriteAttribute { public: WriteUnitTestingLongOctetString() : WriteAttribute("long-octet-string") { AddArgument("attr-name", "long-octet-string"); AddArgument("attr-value", &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingLongOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::LongOctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSData * _Nonnull value = [[NSData alloc] initWithBytes:mValue.data() length:mValue.size()]; [cluster writeAttributeLongOctetStringWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting LongOctetString write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::ByteSpan mValue; }; class SubscribeAttributeUnitTestingLongOctetString : public SubscribeAttribute { public: SubscribeAttributeUnitTestingLongOctetString() : SubscribeAttribute("long-octet-string") { } ~SubscribeAttributeUnitTestingLongOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::LongOctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLongOctetStringWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.LongOctetString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute CharString */ class ReadUnitTestingCharString : public ReadAttribute { public: ReadUnitTestingCharString() : ReadAttribute("char-string") { } ~ReadUnitTestingCharString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::CharString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeCharStringWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.CharString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting CharString read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingCharString : public WriteAttribute { public: WriteUnitTestingCharString() : WriteAttribute("char-string") { AddArgument("attr-name", "char-string"); AddArgument("attr-value", &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingCharString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::CharString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() length:mValue.size() encoding:NSUTF8StringEncoding]; [cluster writeAttributeCharStringWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting CharString write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::ByteSpan mValue; }; class SubscribeAttributeUnitTestingCharString : public SubscribeAttribute { public: SubscribeAttributeUnitTestingCharString() : SubscribeAttribute("char-string") { } ~SubscribeAttributeUnitTestingCharString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::CharString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeCharStringWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.CharString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute LongCharString */ class ReadUnitTestingLongCharString : public ReadAttribute { public: ReadUnitTestingLongCharString() : ReadAttribute("long-char-string") { } ~ReadUnitTestingLongCharString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::LongCharString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeLongCharStringWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.LongCharString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting LongCharString read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingLongCharString : public WriteAttribute { public: WriteUnitTestingLongCharString() : WriteAttribute("long-char-string") { AddArgument("attr-name", "long-char-string"); AddArgument("attr-value", &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingLongCharString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::LongCharString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSString * _Nonnull value = [[NSString alloc] initWithBytes:mValue.data() length:mValue.size() encoding:NSUTF8StringEncoding]; [cluster writeAttributeLongCharStringWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting LongCharString write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::ByteSpan mValue; }; class SubscribeAttributeUnitTestingLongCharString : public SubscribeAttribute { public: SubscribeAttributeUnitTestingLongCharString() : SubscribeAttribute("long-char-string") { } ~SubscribeAttributeUnitTestingLongCharString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::LongCharString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeLongCharStringWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.LongCharString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute EpochUs */ class ReadUnitTestingEpochUs : public ReadAttribute { public: ReadUnitTestingEpochUs() : ReadAttribute("epoch-us") { } ~ReadUnitTestingEpochUs() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::EpochUs::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEpochUsWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.EpochUs response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting EpochUs read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingEpochUs : public WriteAttribute { public: WriteUnitTestingEpochUs() : WriteAttribute("epoch-us") { AddArgument("attr-name", "epoch-us"); AddArgument("attr-value", 0, UINT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingEpochUs() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::EpochUs::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedLongLong:mValue]; [cluster writeAttributeEpochUsWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting EpochUs write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint64_t mValue; }; class SubscribeAttributeUnitTestingEpochUs : public SubscribeAttribute { public: SubscribeAttributeUnitTestingEpochUs() : SubscribeAttribute("epoch-us") { } ~SubscribeAttributeUnitTestingEpochUs() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::EpochUs::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEpochUsWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.EpochUs response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute EpochS */ class ReadUnitTestingEpochS : public ReadAttribute { public: ReadUnitTestingEpochS() : ReadAttribute("epoch-s") { } ~ReadUnitTestingEpochS() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::EpochS::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEpochSWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.EpochS response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting EpochS read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingEpochS : public WriteAttribute { public: WriteUnitTestingEpochS() : WriteAttribute("epoch-s") { AddArgument("attr-name", "epoch-s"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingEpochS() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::EpochS::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; [cluster writeAttributeEpochSWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting EpochS write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint32_t mValue; }; class SubscribeAttributeUnitTestingEpochS : public SubscribeAttribute { public: SubscribeAttributeUnitTestingEpochS() : SubscribeAttribute("epoch-s") { } ~SubscribeAttributeUnitTestingEpochS() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::EpochS::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEpochSWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.EpochS response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute VendorId */ class ReadUnitTestingVendorId : public ReadAttribute { public: ReadUnitTestingVendorId() : ReadAttribute("vendor-id") { } ~ReadUnitTestingVendorId() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::VendorId::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeVendorIdWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.VendorId response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting VendorId read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingVendorId : public WriteAttribute { public: WriteUnitTestingVendorId() : WriteAttribute("vendor-id") { AddArgument("attr-name", "vendor-id"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingVendorId() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::VendorId::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeVendorIdWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting VendorId write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::VendorId mValue; }; class SubscribeAttributeUnitTestingVendorId : public SubscribeAttribute { public: SubscribeAttributeUnitTestingVendorId() : SubscribeAttribute("vendor-id") { } ~SubscribeAttributeUnitTestingVendorId() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::VendorId::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeVendorIdWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.VendorId response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ListNullablesAndOptionalsStruct */ class ReadUnitTestingListNullablesAndOptionalsStruct : public ReadAttribute { public: ReadUnitTestingListNullablesAndOptionalsStruct() : ReadAttribute("list-nullables-and-optionals-struct") { } ~ReadUnitTestingListNullablesAndOptionalsStruct() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListNullablesAndOptionalsStruct::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeListNullablesAndOptionalsStructWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ListNullablesAndOptionalsStruct response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting ListNullablesAndOptionalsStruct read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingListNullablesAndOptionalsStruct : public WriteAttribute { public: WriteUnitTestingListNullablesAndOptionalsStruct() : WriteAttribute("list-nullables-and-optionals-struct") , mComplex(&mValue) { AddArgument("attr-name", "list-nullables-and-optionals-struct"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteUnitTestingListNullablesAndOptionalsStruct() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListNullablesAndOptionalsStruct::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSArray * _Nonnull value; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { MTRUnitTestingClusterNullablesAndOptionalsStruct * newElement_0; newElement_0 = [MTRUnitTestingClusterNullablesAndOptionalsStruct new]; if (entry_0.nullableInt.IsNull()) { newElement_0.nullableInt = nil; } else { newElement_0.nullableInt = [NSNumber numberWithUnsignedShort:entry_0.nullableInt.Value()]; } if (entry_0.optionalInt.HasValue()) { newElement_0.optionalInt = [NSNumber numberWithUnsignedShort:entry_0.optionalInt.Value()]; } else { newElement_0.optionalInt = nil; } if (entry_0.nullableOptionalInt.HasValue()) { if (entry_0.nullableOptionalInt.Value().IsNull()) { newElement_0.nullableOptionalInt = nil; } else { newElement_0.nullableOptionalInt = [NSNumber numberWithUnsignedShort:entry_0.nullableOptionalInt.Value().Value()]; } } else { newElement_0.nullableOptionalInt = nil; } if (entry_0.nullableString.IsNull()) { newElement_0.nullableString = nil; } else { newElement_0.nullableString = [[NSString alloc] initWithBytes:entry_0.nullableString.Value().data() length:entry_0.nullableString.Value().size() encoding:NSUTF8StringEncoding]; } if (entry_0.optionalString.HasValue()) { newElement_0.optionalString = [[NSString alloc] initWithBytes:entry_0.optionalString.Value().data() length:entry_0.optionalString.Value().size() encoding:NSUTF8StringEncoding]; } else { newElement_0.optionalString = nil; } if (entry_0.nullableOptionalString.HasValue()) { if (entry_0.nullableOptionalString.Value().IsNull()) { newElement_0.nullableOptionalString = nil; } else { newElement_0.nullableOptionalString = [[NSString alloc] initWithBytes:entry_0.nullableOptionalString.Value().Value().data() length:entry_0.nullableOptionalString.Value().Value().size() encoding:NSUTF8StringEncoding]; } } else { newElement_0.nullableOptionalString = nil; } if (entry_0.nullableStruct.IsNull()) { newElement_0.nullableStruct = nil; } else { newElement_0.nullableStruct = [MTRUnitTestingClusterSimpleStruct new]; newElement_0.nullableStruct.a = [NSNumber numberWithUnsignedChar:entry_0.nullableStruct.Value().a]; newElement_0.nullableStruct.b = [NSNumber numberWithBool:entry_0.nullableStruct.Value().b]; newElement_0.nullableStruct.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.nullableStruct.Value().c)]; newElement_0.nullableStruct.d = [NSData dataWithBytes:entry_0.nullableStruct.Value().d.data() length:entry_0.nullableStruct.Value().d.size()]; newElement_0.nullableStruct.e = [[NSString alloc] initWithBytes:entry_0.nullableStruct.Value().e.data() length:entry_0.nullableStruct.Value().e.size() encoding:NSUTF8StringEncoding]; newElement_0.nullableStruct.f = [NSNumber numberWithUnsignedChar:entry_0.nullableStruct.Value().f.Raw()]; newElement_0.nullableStruct.g = [NSNumber numberWithFloat:entry_0.nullableStruct.Value().g]; newElement_0.nullableStruct.h = [NSNumber numberWithDouble:entry_0.nullableStruct.Value().h]; if (entry_0.nullableStruct.Value().i.HasValue()) { newElement_0.nullableStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.nullableStruct.Value().i.Value())]; } else { newElement_0.nullableStruct.i = nil; } } if (entry_0.optionalStruct.HasValue()) { newElement_0.optionalStruct = [MTRUnitTestingClusterSimpleStruct new]; newElement_0.optionalStruct.a = [NSNumber numberWithUnsignedChar:entry_0.optionalStruct.Value().a]; newElement_0.optionalStruct.b = [NSNumber numberWithBool:entry_0.optionalStruct.Value().b]; newElement_0.optionalStruct.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.optionalStruct.Value().c)]; newElement_0.optionalStruct.d = [NSData dataWithBytes:entry_0.optionalStruct.Value().d.data() length:entry_0.optionalStruct.Value().d.size()]; newElement_0.optionalStruct.e = [[NSString alloc] initWithBytes:entry_0.optionalStruct.Value().e.data() length:entry_0.optionalStruct.Value().e.size() encoding:NSUTF8StringEncoding]; newElement_0.optionalStruct.f = [NSNumber numberWithUnsignedChar:entry_0.optionalStruct.Value().f.Raw()]; newElement_0.optionalStruct.g = [NSNumber numberWithFloat:entry_0.optionalStruct.Value().g]; newElement_0.optionalStruct.h = [NSNumber numberWithDouble:entry_0.optionalStruct.Value().h]; if (entry_0.optionalStruct.Value().i.HasValue()) { newElement_0.optionalStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.optionalStruct.Value().i.Value())]; } else { newElement_0.optionalStruct.i = nil; } } else { newElement_0.optionalStruct = nil; } if (entry_0.nullableOptionalStruct.HasValue()) { if (entry_0.nullableOptionalStruct.Value().IsNull()) { newElement_0.nullableOptionalStruct = nil; } else { newElement_0.nullableOptionalStruct = [MTRUnitTestingClusterSimpleStruct new]; newElement_0.nullableOptionalStruct.a = [NSNumber numberWithUnsignedChar:entry_0.nullableOptionalStruct.Value().Value().a]; newElement_0.nullableOptionalStruct.b = [NSNumber numberWithBool:entry_0.nullableOptionalStruct.Value().Value().b]; newElement_0.nullableOptionalStruct.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.nullableOptionalStruct.Value().Value().c)]; newElement_0.nullableOptionalStruct.d = [NSData dataWithBytes:entry_0.nullableOptionalStruct.Value().Value().d.data() length:entry_0.nullableOptionalStruct.Value().Value().d.size()]; newElement_0.nullableOptionalStruct.e = [[NSString alloc] initWithBytes:entry_0.nullableOptionalStruct.Value().Value().e.data() length:entry_0.nullableOptionalStruct.Value().Value().e.size() encoding:NSUTF8StringEncoding]; newElement_0.nullableOptionalStruct.f = [NSNumber numberWithUnsignedChar:entry_0.nullableOptionalStruct.Value().Value().f.Raw()]; newElement_0.nullableOptionalStruct.g = [NSNumber numberWithFloat:entry_0.nullableOptionalStruct.Value().Value().g]; newElement_0.nullableOptionalStruct.h = [NSNumber numberWithDouble:entry_0.nullableOptionalStruct.Value().Value().h]; if (entry_0.nullableOptionalStruct.Value().Value().i.HasValue()) { newElement_0.nullableOptionalStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.nullableOptionalStruct.Value().Value().i.Value())]; } else { newElement_0.nullableOptionalStruct.i = nil; } } } else { newElement_0.nullableOptionalStruct = nil; } if (entry_0.nullableList.IsNull()) { newElement_0.nullableList = nil; } else { { // Scope for our temporary variables auto * array_3 = [NSMutableArray new]; for (auto & entry_3 : entry_0.nullableList.Value()) { NSNumber * newElement_3; newElement_3 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_3)]; [array_3 addObject:newElement_3]; } newElement_0.nullableList = array_3; } } if (entry_0.optionalList.HasValue()) { { // Scope for our temporary variables auto * array_3 = [NSMutableArray new]; for (auto & entry_3 : entry_0.optionalList.Value()) { NSNumber * newElement_3; newElement_3 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_3)]; [array_3 addObject:newElement_3]; } newElement_0.optionalList = array_3; } } else { newElement_0.optionalList = nil; } if (entry_0.nullableOptionalList.HasValue()) { if (entry_0.nullableOptionalList.Value().IsNull()) { newElement_0.nullableOptionalList = nil; } else { { // Scope for our temporary variables auto * array_4 = [NSMutableArray new]; for (auto & entry_4 : entry_0.nullableOptionalList.Value().Value()) { NSNumber * newElement_4; newElement_4 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_4)]; [array_4 addObject:newElement_4]; } newElement_0.nullableOptionalList = array_4; } } } else { newElement_0.nullableOptionalList = nil; } [array_0 addObject:newElement_0]; } value = array_0; } [cluster writeAttributeListNullablesAndOptionalsStructWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting ListNullablesAndOptionalsStruct write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::List mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeUnitTestingListNullablesAndOptionalsStruct : public SubscribeAttribute { public: SubscribeAttributeUnitTestingListNullablesAndOptionalsStruct() : SubscribeAttribute("list-nullables-and-optionals-struct") { } ~SubscribeAttributeUnitTestingListNullablesAndOptionalsStruct() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListNullablesAndOptionalsStruct::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeListNullablesAndOptionalsStructWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ListNullablesAndOptionalsStruct response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute EnumAttr */ class ReadUnitTestingEnumAttr : public ReadAttribute { public: ReadUnitTestingEnumAttr() : ReadAttribute("enum-attr") { } ~ReadUnitTestingEnumAttr() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::EnumAttr::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEnumAttrWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.EnumAttr response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting EnumAttr read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingEnumAttr : public WriteAttribute { public: WriteUnitTestingEnumAttr() : WriteAttribute("enum-attr") { AddArgument("attr-name", "enum-attr"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingEnumAttr() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::EnumAttr::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeEnumAttrWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting EnumAttr write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeUnitTestingEnumAttr : public SubscribeAttribute { public: SubscribeAttributeUnitTestingEnumAttr() : SubscribeAttribute("enum-attr") { } ~SubscribeAttributeUnitTestingEnumAttr() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::EnumAttr::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEnumAttrWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.EnumAttr response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute StructAttr */ class ReadUnitTestingStructAttr : public ReadAttribute { public: ReadUnitTestingStructAttr() : ReadAttribute("struct-attr") { } ~ReadUnitTestingStructAttr() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::StructAttr::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeStructAttrWithCompletion:^(MTRUnitTestingClusterSimpleStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.StructAttr response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting StructAttr read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingStructAttr : public WriteAttribute { public: WriteUnitTestingStructAttr() : WriteAttribute("struct-attr") , mComplex(&mValue) { AddArgument("attr-name", "struct-attr"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteUnitTestingStructAttr() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::StructAttr::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; MTRUnitTestingClusterSimpleStruct * _Nonnull value; value = [MTRUnitTestingClusterSimpleStruct new]; value.a = [NSNumber numberWithUnsignedChar:mValue.a]; value.b = [NSNumber numberWithBool:mValue.b]; value.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mValue.c)]; value.d = [NSData dataWithBytes:mValue.d.data() length:mValue.d.size()]; value.e = [[NSString alloc] initWithBytes:mValue.e.data() length:mValue.e.size() encoding:NSUTF8StringEncoding]; value.f = [NSNumber numberWithUnsignedChar:mValue.f.Raw()]; value.g = [NSNumber numberWithFloat:mValue.g]; value.h = [NSNumber numberWithDouble:mValue.h]; if (mValue.i.HasValue()) { value.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mValue.i.Value())]; } else { value.i = nil; } [cluster writeAttributeStructAttrWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting StructAttr write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::Clusters::UnitTesting::Structs::SimpleStruct::Type mValue; TypedComplexArgument mComplex; }; class SubscribeAttributeUnitTestingStructAttr : public SubscribeAttribute { public: SubscribeAttributeUnitTestingStructAttr() : SubscribeAttribute("struct-attr") { } ~SubscribeAttributeUnitTestingStructAttr() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::StructAttr::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeStructAttrWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRUnitTestingClusterSimpleStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.StructAttr response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RangeRestrictedInt8u */ class ReadUnitTestingRangeRestrictedInt8u : public ReadAttribute { public: ReadUnitTestingRangeRestrictedInt8u() : ReadAttribute("range-restricted-int8u") { } ~ReadUnitTestingRangeRestrictedInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::RangeRestrictedInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRangeRestrictedInt8uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.RangeRestrictedInt8u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting RangeRestrictedInt8u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingRangeRestrictedInt8u : public WriteAttribute { public: WriteUnitTestingRangeRestrictedInt8u() : WriteAttribute("range-restricted-int8u") { AddArgument("attr-name", "range-restricted-int8u"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingRangeRestrictedInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::RangeRestrictedInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeRangeRestrictedInt8uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting RangeRestrictedInt8u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeUnitTestingRangeRestrictedInt8u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingRangeRestrictedInt8u() : SubscribeAttribute("range-restricted-int8u") { } ~SubscribeAttributeUnitTestingRangeRestrictedInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::RangeRestrictedInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRangeRestrictedInt8uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.RangeRestrictedInt8u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RangeRestrictedInt8s */ class ReadUnitTestingRangeRestrictedInt8s : public ReadAttribute { public: ReadUnitTestingRangeRestrictedInt8s() : ReadAttribute("range-restricted-int8s") { } ~ReadUnitTestingRangeRestrictedInt8s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::RangeRestrictedInt8s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRangeRestrictedInt8sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.RangeRestrictedInt8s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting RangeRestrictedInt8s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingRangeRestrictedInt8s : public WriteAttribute { public: WriteUnitTestingRangeRestrictedInt8s() : WriteAttribute("range-restricted-int8s") { AddArgument("attr-name", "range-restricted-int8s"); AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingRangeRestrictedInt8s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::RangeRestrictedInt8s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithChar:mValue]; [cluster writeAttributeRangeRestrictedInt8sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting RangeRestrictedInt8s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int8_t mValue; }; class SubscribeAttributeUnitTestingRangeRestrictedInt8s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingRangeRestrictedInt8s() : SubscribeAttribute("range-restricted-int8s") { } ~SubscribeAttributeUnitTestingRangeRestrictedInt8s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::RangeRestrictedInt8s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRangeRestrictedInt8sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.RangeRestrictedInt8s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RangeRestrictedInt16u */ class ReadUnitTestingRangeRestrictedInt16u : public ReadAttribute { public: ReadUnitTestingRangeRestrictedInt16u() : ReadAttribute("range-restricted-int16u") { } ~ReadUnitTestingRangeRestrictedInt16u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::RangeRestrictedInt16u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRangeRestrictedInt16uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.RangeRestrictedInt16u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting RangeRestrictedInt16u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingRangeRestrictedInt16u : public WriteAttribute { public: WriteUnitTestingRangeRestrictedInt16u() : WriteAttribute("range-restricted-int16u") { AddArgument("attr-name", "range-restricted-int16u"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingRangeRestrictedInt16u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::RangeRestrictedInt16u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedShort:mValue]; [cluster writeAttributeRangeRestrictedInt16uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting RangeRestrictedInt16u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint16_t mValue; }; class SubscribeAttributeUnitTestingRangeRestrictedInt16u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingRangeRestrictedInt16u() : SubscribeAttribute("range-restricted-int16u") { } ~SubscribeAttributeUnitTestingRangeRestrictedInt16u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::RangeRestrictedInt16u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRangeRestrictedInt16uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.RangeRestrictedInt16u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute RangeRestrictedInt16s */ class ReadUnitTestingRangeRestrictedInt16s : public ReadAttribute { public: ReadUnitTestingRangeRestrictedInt16s() : ReadAttribute("range-restricted-int16s") { } ~ReadUnitTestingRangeRestrictedInt16s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::RangeRestrictedInt16s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeRangeRestrictedInt16sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.RangeRestrictedInt16s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting RangeRestrictedInt16s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingRangeRestrictedInt16s : public WriteAttribute { public: WriteUnitTestingRangeRestrictedInt16s() : WriteAttribute("range-restricted-int16s") { AddArgument("attr-name", "range-restricted-int16s"); AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingRangeRestrictedInt16s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::RangeRestrictedInt16s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithShort:mValue]; [cluster writeAttributeRangeRestrictedInt16sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting RangeRestrictedInt16s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: int16_t mValue; }; class SubscribeAttributeUnitTestingRangeRestrictedInt16s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingRangeRestrictedInt16s() : SubscribeAttribute("range-restricted-int16s") { } ~SubscribeAttributeUnitTestingRangeRestrictedInt16s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::RangeRestrictedInt16s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeRangeRestrictedInt16sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.RangeRestrictedInt16s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ListLongOctetString */ class ReadUnitTestingListLongOctetString : public ReadAttribute { public: ReadUnitTestingListLongOctetString() : ReadAttribute("list-long-octet-string") { } ~ReadUnitTestingListLongOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListLongOctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeListLongOctetStringWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ListLongOctetString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting ListLongOctetString read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingListLongOctetString : public WriteAttribute { public: WriteUnitTestingListLongOctetString() : WriteAttribute("list-long-octet-string") , mComplex(&mValue) { AddArgument("attr-name", "list-long-octet-string"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteUnitTestingListLongOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListLongOctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSArray * _Nonnull value; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { NSData * newElement_0; newElement_0 = [NSData dataWithBytes:entry_0.data() length:entry_0.size()]; [array_0 addObject:newElement_0]; } value = array_0; } [cluster writeAttributeListLongOctetStringWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting ListLongOctetString write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::List mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeUnitTestingListLongOctetString : public SubscribeAttribute { public: SubscribeAttributeUnitTestingListLongOctetString() : SubscribeAttribute("list-long-octet-string") { } ~SubscribeAttributeUnitTestingListLongOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListLongOctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeListLongOctetStringWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ListLongOctetString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ListFabricScoped */ class ReadUnitTestingListFabricScoped : public ReadAttribute { public: ReadUnitTestingListFabricScoped() : ReadAttribute("list-fabric-scoped") { } ~ReadUnitTestingListFabricScoped() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListFabricScoped::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRReadParams alloc] init]; if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } [cluster readAttributeListFabricScopedWithParams:params completion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ListFabricScoped response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting ListFabricScoped read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingListFabricScoped : public WriteAttribute { public: WriteUnitTestingListFabricScoped() : WriteAttribute("list-fabric-scoped") , mComplex(&mValue) { AddArgument("attr-name", "list-fabric-scoped"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteUnitTestingListFabricScoped() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListFabricScoped::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSArray * _Nonnull value; { // Scope for our temporary variables auto * array_0 = [NSMutableArray new]; for (auto & entry_0 : mValue) { MTRUnitTestingClusterTestFabricScoped * newElement_0; newElement_0 = [MTRUnitTestingClusterTestFabricScoped new]; newElement_0.fabricSensitiveInt8u = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveInt8u]; if (entry_0.optionalFabricSensitiveInt8u.HasValue()) { newElement_0.optionalFabricSensitiveInt8u = [NSNumber numberWithUnsignedChar:entry_0.optionalFabricSensitiveInt8u.Value()]; } else { newElement_0.optionalFabricSensitiveInt8u = nil; } if (entry_0.nullableFabricSensitiveInt8u.IsNull()) { newElement_0.nullableFabricSensitiveInt8u = nil; } else { newElement_0.nullableFabricSensitiveInt8u = [NSNumber numberWithUnsignedChar:entry_0.nullableFabricSensitiveInt8u.Value()]; } if (entry_0.nullableOptionalFabricSensitiveInt8u.HasValue()) { if (entry_0.nullableOptionalFabricSensitiveInt8u.Value().IsNull()) { newElement_0.nullableOptionalFabricSensitiveInt8u = nil; } else { newElement_0.nullableOptionalFabricSensitiveInt8u = [NSNumber numberWithUnsignedChar:entry_0.nullableOptionalFabricSensitiveInt8u.Value().Value()]; } } else { newElement_0.nullableOptionalFabricSensitiveInt8u = nil; } newElement_0.fabricSensitiveCharString = [[NSString alloc] initWithBytes:entry_0.fabricSensitiveCharString.data() length:entry_0.fabricSensitiveCharString.size() encoding:NSUTF8StringEncoding]; newElement_0.fabricSensitiveStruct = [MTRUnitTestingClusterSimpleStruct new]; newElement_0.fabricSensitiveStruct.a = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveStruct.a]; newElement_0.fabricSensitiveStruct.b = [NSNumber numberWithBool:entry_0.fabricSensitiveStruct.b]; newElement_0.fabricSensitiveStruct.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.fabricSensitiveStruct.c)]; newElement_0.fabricSensitiveStruct.d = [NSData dataWithBytes:entry_0.fabricSensitiveStruct.d.data() length:entry_0.fabricSensitiveStruct.d.size()]; newElement_0.fabricSensitiveStruct.e = [[NSString alloc] initWithBytes:entry_0.fabricSensitiveStruct.e.data() length:entry_0.fabricSensitiveStruct.e.size() encoding:NSUTF8StringEncoding]; newElement_0.fabricSensitiveStruct.f = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveStruct.f.Raw()]; newElement_0.fabricSensitiveStruct.g = [NSNumber numberWithFloat:entry_0.fabricSensitiveStruct.g]; newElement_0.fabricSensitiveStruct.h = [NSNumber numberWithDouble:entry_0.fabricSensitiveStruct.h]; if (entry_0.fabricSensitiveStruct.i.HasValue()) { newElement_0.fabricSensitiveStruct.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.fabricSensitiveStruct.i.Value())]; } else { newElement_0.fabricSensitiveStruct.i = nil; } { // Scope for our temporary variables auto * array_2 = [NSMutableArray new]; for (auto & entry_2 : entry_0.fabricSensitiveInt8uList) { NSNumber * newElement_2; newElement_2 = [NSNumber numberWithUnsignedChar:entry_2]; [array_2 addObject:newElement_2]; } newElement_0.fabricSensitiveInt8uList = array_2; } newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; [array_0 addObject:newElement_0]; } value = array_0; } [cluster writeAttributeListFabricScopedWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting ListFabricScoped write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::List mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeUnitTestingListFabricScoped : public SubscribeAttribute { public: SubscribeAttributeUnitTestingListFabricScoped() : SubscribeAttribute("list-fabric-scoped") { } ~SubscribeAttributeUnitTestingListFabricScoped() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::ListFabricScoped::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeListFabricScopedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ListFabricScoped response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute TimedWriteBoolean */ class ReadUnitTestingTimedWriteBoolean : public ReadAttribute { public: ReadUnitTestingTimedWriteBoolean() : ReadAttribute("timed-write-boolean") { } ~ReadUnitTestingTimedWriteBoolean() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::TimedWriteBoolean::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeTimedWriteBooleanWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.TimedWriteBoolean response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting TimedWriteBoolean read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingTimedWriteBoolean : public WriteAttribute { public: WriteUnitTestingTimedWriteBoolean() : WriteAttribute("timed-write-boolean") { AddArgument("attr-name", "timed-write-boolean"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingTimedWriteBoolean() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::TimedWriteBoolean::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeTimedWriteBooleanWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting TimedWriteBoolean write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeUnitTestingTimedWriteBoolean : public SubscribeAttribute { public: SubscribeAttributeUnitTestingTimedWriteBoolean() : SubscribeAttribute("timed-write-boolean") { } ~SubscribeAttributeUnitTestingTimedWriteBoolean() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::TimedWriteBoolean::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeTimedWriteBooleanWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.TimedWriteBoolean response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute GeneralErrorBoolean */ class ReadUnitTestingGeneralErrorBoolean : public ReadAttribute { public: ReadUnitTestingGeneralErrorBoolean() : ReadAttribute("general-error-boolean") { } ~ReadUnitTestingGeneralErrorBoolean() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::GeneralErrorBoolean::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneralErrorBooleanWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.GeneralErrorBoolean response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting GeneralErrorBoolean read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingGeneralErrorBoolean : public WriteAttribute { public: WriteUnitTestingGeneralErrorBoolean() : WriteAttribute("general-error-boolean") { AddArgument("attr-name", "general-error-boolean"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingGeneralErrorBoolean() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::GeneralErrorBoolean::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeGeneralErrorBooleanWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting GeneralErrorBoolean write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeUnitTestingGeneralErrorBoolean : public SubscribeAttribute { public: SubscribeAttributeUnitTestingGeneralErrorBoolean() : SubscribeAttribute("general-error-boolean") { } ~SubscribeAttributeUnitTestingGeneralErrorBoolean() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::GeneralErrorBoolean::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneralErrorBooleanWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.GeneralErrorBoolean response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterErrorBoolean */ class ReadUnitTestingClusterErrorBoolean : public ReadAttribute { public: ReadUnitTestingClusterErrorBoolean() : ReadAttribute("cluster-error-boolean") { } ~ReadUnitTestingClusterErrorBoolean() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ClusterErrorBoolean::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterErrorBooleanWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ClusterErrorBoolean response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting ClusterErrorBoolean read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingClusterErrorBoolean : public WriteAttribute { public: WriteUnitTestingClusterErrorBoolean() : WriteAttribute("cluster-error-boolean") { AddArgument("attr-name", "cluster-error-boolean"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingClusterErrorBoolean() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ClusterErrorBoolean::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeClusterErrorBooleanWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting ClusterErrorBoolean write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeUnitTestingClusterErrorBoolean : public SubscribeAttribute { public: SubscribeAttributeUnitTestingClusterErrorBoolean() : SubscribeAttribute("cluster-error-boolean") { } ~SubscribeAttributeUnitTestingClusterErrorBoolean() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::ClusterErrorBoolean::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterErrorBooleanWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ClusterErrorBoolean response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute GlobalEnum */ class ReadUnitTestingGlobalEnum : public ReadAttribute { public: ReadUnitTestingGlobalEnum() : ReadAttribute("global-enum") { } ~ReadUnitTestingGlobalEnum() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::GlobalEnum::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGlobalEnumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.GlobalEnum response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting GlobalEnum read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingGlobalEnum : public WriteAttribute { public: WriteUnitTestingGlobalEnum() : WriteAttribute("global-enum") { AddArgument("attr-name", "global-enum"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingGlobalEnum() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::GlobalEnum::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeGlobalEnumWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting GlobalEnum write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeUnitTestingGlobalEnum : public SubscribeAttribute { public: SubscribeAttributeUnitTestingGlobalEnum() : SubscribeAttribute("global-enum") { } ~SubscribeAttributeUnitTestingGlobalEnum() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::GlobalEnum::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGlobalEnumWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.GlobalEnum response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GlobalStruct */ class ReadUnitTestingGlobalStruct : public ReadAttribute { public: ReadUnitTestingGlobalStruct() : ReadAttribute("global-struct") { } ~ReadUnitTestingGlobalStruct() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::GlobalStruct::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGlobalStructWithCompletion:^(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.GlobalStruct response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting GlobalStruct read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingGlobalStruct : public WriteAttribute { public: WriteUnitTestingGlobalStruct() : WriteAttribute("global-struct") , mComplex(&mValue) { AddArgument("attr-name", "global-struct"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteUnitTestingGlobalStruct() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::GlobalStruct::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; MTRDataTypeTestGlobalStruct * _Nonnull value; value = [MTRDataTypeTestGlobalStruct new]; value.name = [[NSString alloc] initWithBytes:mValue.name.data() length:mValue.name.size() encoding:NSUTF8StringEncoding]; if (mValue.myBitmap.IsNull()) { value.myBitmap = nil; } else { value.myBitmap = [NSNumber numberWithUnsignedInt:mValue.myBitmap.Value().Raw()]; } if (mValue.myEnum.HasValue()) { if (mValue.myEnum.Value().IsNull()) { value.myEnum = nil; } else { value.myEnum = [NSNumber numberWithUnsignedChar:chip::to_underlying(mValue.myEnum.Value().Value())]; } } else { value.myEnum = nil; } [cluster writeAttributeGlobalStructWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting GlobalStruct write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::Clusters::Globals::Structs::TestGlobalStruct::Type mValue; TypedComplexArgument mComplex; }; class SubscribeAttributeUnitTestingGlobalStruct : public SubscribeAttribute { public: SubscribeAttributeUnitTestingGlobalStruct() : SubscribeAttribute("global-struct") { } ~SubscribeAttributeUnitTestingGlobalStruct() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::GlobalStruct::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGlobalStructWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.GlobalStruct response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute Unsupported */ class ReadUnitTestingUnsupported : public ReadAttribute { public: ReadUnitTestingUnsupported() : ReadAttribute("unsupported") { } ~ReadUnitTestingUnsupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Unsupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeUnsupportedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Unsupported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting Unsupported read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingUnsupported : public WriteAttribute { public: WriteUnitTestingUnsupported() : WriteAttribute("unsupported") { AddArgument("attr-name", "unsupported"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingUnsupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::Unsupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeUnsupportedWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting Unsupported write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeUnitTestingUnsupported : public SubscribeAttribute { public: SubscribeAttributeUnitTestingUnsupported() : SubscribeAttribute("unsupported") { } ~SubscribeAttributeUnitTestingUnsupported() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::Unsupported::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeUnsupportedWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.Unsupported response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute ReadFailureCode */ class ReadUnitTestingReadFailureCode : public ReadAttribute { public: ReadUnitTestingReadFailureCode() : ReadAttribute("read-failure-code") { } ~ReadUnitTestingReadFailureCode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ReadFailureCode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeReadFailureCodeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ReadFailureCode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting ReadFailureCode read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingReadFailureCode : public WriteAttribute { public: WriteUnitTestingReadFailureCode() : WriteAttribute("read-failure-code") { AddArgument("attr-name", "read-failure-code"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingReadFailureCode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ReadFailureCode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeReadFailureCodeWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting ReadFailureCode write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeUnitTestingReadFailureCode : public SubscribeAttribute { public: SubscribeAttributeUnitTestingReadFailureCode() : SubscribeAttribute("read-failure-code") { } ~SubscribeAttributeUnitTestingReadFailureCode() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::ReadFailureCode::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeReadFailureCodeWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ReadFailureCode response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FailureInt32U */ class ReadUnitTestingFailureInt32U : public ReadAttribute { public: ReadUnitTestingFailureInt32U() : ReadAttribute("failure-int32u") { } ~ReadUnitTestingFailureInt32U() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::FailureInt32U::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFailureInt32UWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.FailureInt32U response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting FailureInt32U read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingFailureInt32U : public WriteAttribute { public: WriteUnitTestingFailureInt32U() : WriteAttribute("failure-int32u") { AddArgument("attr-name", "failure-int32u"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingFailureInt32U() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::FailureInt32U::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedInt:mValue]; [cluster writeAttributeFailureInt32UWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting FailureInt32U write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint32_t mValue; }; class SubscribeAttributeUnitTestingFailureInt32U : public SubscribeAttribute { public: SubscribeAttributeUnitTestingFailureInt32U() : SubscribeAttribute("failure-int32u") { } ~SubscribeAttributeUnitTestingFailureInt32U() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::FailureInt32U::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFailureInt32UWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.FailureInt32U response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute NullableBoolean */ class ReadUnitTestingNullableBoolean : public ReadAttribute { public: ReadUnitTestingNullableBoolean() : ReadAttribute("nullable-boolean") { } ~ReadUnitTestingNullableBoolean() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableBoolean::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableBooleanWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableBoolean response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableBoolean read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableBoolean : public WriteAttribute { public: WriteUnitTestingNullableBoolean() : WriteAttribute("nullable-boolean") { AddArgument("attr-name", "nullable-boolean"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableBoolean() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableBoolean::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithBool:mValue.Value()]; } [cluster writeAttributeNullableBooleanWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableBoolean write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableBoolean : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableBoolean() : SubscribeAttribute("nullable-boolean") { } ~SubscribeAttributeUnitTestingNullableBoolean() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableBoolean::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableBooleanWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableBoolean response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableBitmap8 */ class ReadUnitTestingNullableBitmap8 : public ReadAttribute { public: ReadUnitTestingNullableBitmap8() : ReadAttribute("nullable-bitmap8") { } ~ReadUnitTestingNullableBitmap8() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableBitmap8::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableBitmap8WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableBitmap8 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableBitmap8 read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableBitmap8 : public WriteAttribute { public: WriteUnitTestingNullableBitmap8() : WriteAttribute("nullable-bitmap8") { AddArgument("attr-name", "nullable-bitmap8"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableBitmap8() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableBitmap8::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeNullableBitmap8WithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableBitmap8 write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableBitmap8 : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableBitmap8() : SubscribeAttribute("nullable-bitmap8") { } ~SubscribeAttributeUnitTestingNullableBitmap8() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableBitmap8::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableBitmap8WithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableBitmap8 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableBitmap16 */ class ReadUnitTestingNullableBitmap16 : public ReadAttribute { public: ReadUnitTestingNullableBitmap16() : ReadAttribute("nullable-bitmap16") { } ~ReadUnitTestingNullableBitmap16() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableBitmap16::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableBitmap16WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableBitmap16 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableBitmap16 read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableBitmap16 : public WriteAttribute { public: WriteUnitTestingNullableBitmap16() : WriteAttribute("nullable-bitmap16") { AddArgument("attr-name", "nullable-bitmap16"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableBitmap16() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableBitmap16::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedShort:mValue.Value()]; } [cluster writeAttributeNullableBitmap16WithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableBitmap16 write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableBitmap16 : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableBitmap16() : SubscribeAttribute("nullable-bitmap16") { } ~SubscribeAttributeUnitTestingNullableBitmap16() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableBitmap16::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableBitmap16WithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableBitmap16 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableBitmap32 */ class ReadUnitTestingNullableBitmap32 : public ReadAttribute { public: ReadUnitTestingNullableBitmap32() : ReadAttribute("nullable-bitmap32") { } ~ReadUnitTestingNullableBitmap32() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableBitmap32::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableBitmap32WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableBitmap32 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableBitmap32 read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableBitmap32 : public WriteAttribute { public: WriteUnitTestingNullableBitmap32() : WriteAttribute("nullable-bitmap32") { AddArgument("attr-name", "nullable-bitmap32"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableBitmap32() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableBitmap32::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedInt:mValue.Value()]; } [cluster writeAttributeNullableBitmap32WithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableBitmap32 write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableBitmap32 : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableBitmap32() : SubscribeAttribute("nullable-bitmap32") { } ~SubscribeAttributeUnitTestingNullableBitmap32() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableBitmap32::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableBitmap32WithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableBitmap32 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableBitmap64 */ class ReadUnitTestingNullableBitmap64 : public ReadAttribute { public: ReadUnitTestingNullableBitmap64() : ReadAttribute("nullable-bitmap64") { } ~ReadUnitTestingNullableBitmap64() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableBitmap64::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableBitmap64WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableBitmap64 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableBitmap64 read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableBitmap64 : public WriteAttribute { public: WriteUnitTestingNullableBitmap64() : WriteAttribute("nullable-bitmap64") { AddArgument("attr-name", "nullable-bitmap64"); AddArgument("attr-value", 0, UINT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableBitmap64() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableBitmap64::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedLongLong:mValue.Value()]; } [cluster writeAttributeNullableBitmap64WithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableBitmap64 write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableBitmap64 : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableBitmap64() : SubscribeAttribute("nullable-bitmap64") { } ~SubscribeAttributeUnitTestingNullableBitmap64() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableBitmap64::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableBitmap64WithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableBitmap64 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableInt8u */ class ReadUnitTestingNullableInt8u : public ReadAttribute { public: ReadUnitTestingNullableInt8u() : ReadAttribute("nullable-int8u") { } ~ReadUnitTestingNullableInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableInt8uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt8u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableInt8u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableInt8u : public WriteAttribute { public: WriteUnitTestingNullableInt8u() : WriteAttribute("nullable-int8u") { AddArgument("attr-name", "nullable-int8u"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeNullableInt8uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableInt8u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableInt8u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableInt8u() : SubscribeAttribute("nullable-int8u") { } ~SubscribeAttributeUnitTestingNullableInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableInt8uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt8u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableInt16u */ class ReadUnitTestingNullableInt16u : public ReadAttribute { public: ReadUnitTestingNullableInt16u() : ReadAttribute("nullable-int16u") { } ~ReadUnitTestingNullableInt16u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt16u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableInt16uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt16u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableInt16u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableInt16u : public WriteAttribute { public: WriteUnitTestingNullableInt16u() : WriteAttribute("nullable-int16u") { AddArgument("attr-name", "nullable-int16u"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableInt16u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt16u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedShort:mValue.Value()]; } [cluster writeAttributeNullableInt16uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableInt16u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableInt16u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableInt16u() : SubscribeAttribute("nullable-int16u") { } ~SubscribeAttributeUnitTestingNullableInt16u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt16u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableInt16uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt16u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableInt24u */ class ReadUnitTestingNullableInt24u : public ReadAttribute { public: ReadUnitTestingNullableInt24u() : ReadAttribute("nullable-int24u") { } ~ReadUnitTestingNullableInt24u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt24u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableInt24uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt24u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableInt24u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableInt24u : public WriteAttribute { public: WriteUnitTestingNullableInt24u() : WriteAttribute("nullable-int24u") { AddArgument("attr-name", "nullable-int24u"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableInt24u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt24u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedInt:mValue.Value()]; } [cluster writeAttributeNullableInt24uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableInt24u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableInt24u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableInt24u() : SubscribeAttribute("nullable-int24u") { } ~SubscribeAttributeUnitTestingNullableInt24u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt24u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableInt24uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt24u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableInt32u */ class ReadUnitTestingNullableInt32u : public ReadAttribute { public: ReadUnitTestingNullableInt32u() : ReadAttribute("nullable-int32u") { } ~ReadUnitTestingNullableInt32u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt32u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableInt32uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt32u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableInt32u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableInt32u : public WriteAttribute { public: WriteUnitTestingNullableInt32u() : WriteAttribute("nullable-int32u") { AddArgument("attr-name", "nullable-int32u"); AddArgument("attr-value", 0, UINT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableInt32u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt32u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedInt:mValue.Value()]; } [cluster writeAttributeNullableInt32uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableInt32u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableInt32u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableInt32u() : SubscribeAttribute("nullable-int32u") { } ~SubscribeAttributeUnitTestingNullableInt32u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt32u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableInt32uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt32u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableInt40u */ class ReadUnitTestingNullableInt40u : public ReadAttribute { public: ReadUnitTestingNullableInt40u() : ReadAttribute("nullable-int40u") { } ~ReadUnitTestingNullableInt40u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt40u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableInt40uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt40u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableInt40u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableInt40u : public WriteAttribute { public: WriteUnitTestingNullableInt40u() : WriteAttribute("nullable-int40u") { AddArgument("attr-name", "nullable-int40u"); AddArgument("attr-value", 0, UINT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableInt40u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt40u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedLongLong:mValue.Value()]; } [cluster writeAttributeNullableInt40uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableInt40u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableInt40u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableInt40u() : SubscribeAttribute("nullable-int40u") { } ~SubscribeAttributeUnitTestingNullableInt40u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt40u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableInt40uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt40u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableInt48u */ class ReadUnitTestingNullableInt48u : public ReadAttribute { public: ReadUnitTestingNullableInt48u() : ReadAttribute("nullable-int48u") { } ~ReadUnitTestingNullableInt48u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt48u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableInt48uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt48u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableInt48u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableInt48u : public WriteAttribute { public: WriteUnitTestingNullableInt48u() : WriteAttribute("nullable-int48u") { AddArgument("attr-name", "nullable-int48u"); AddArgument("attr-value", 0, UINT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableInt48u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt48u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedLongLong:mValue.Value()]; } [cluster writeAttributeNullableInt48uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableInt48u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableInt48u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableInt48u() : SubscribeAttribute("nullable-int48u") { } ~SubscribeAttributeUnitTestingNullableInt48u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt48u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableInt48uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt48u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableInt56u */ class ReadUnitTestingNullableInt56u : public ReadAttribute { public: ReadUnitTestingNullableInt56u() : ReadAttribute("nullable-int56u") { } ~ReadUnitTestingNullableInt56u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt56u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableInt56uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt56u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableInt56u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableInt56u : public WriteAttribute { public: WriteUnitTestingNullableInt56u() : WriteAttribute("nullable-int56u") { AddArgument("attr-name", "nullable-int56u"); AddArgument("attr-value", 0, UINT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableInt56u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt56u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedLongLong:mValue.Value()]; } [cluster writeAttributeNullableInt56uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableInt56u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableInt56u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableInt56u() : SubscribeAttribute("nullable-int56u") { } ~SubscribeAttributeUnitTestingNullableInt56u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt56u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableInt56uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt56u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableInt64u */ class ReadUnitTestingNullableInt64u : public ReadAttribute { public: ReadUnitTestingNullableInt64u() : ReadAttribute("nullable-int64u") { } ~ReadUnitTestingNullableInt64u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt64u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableInt64uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt64u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableInt64u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableInt64u : public WriteAttribute { public: WriteUnitTestingNullableInt64u() : WriteAttribute("nullable-int64u") { AddArgument("attr-name", "nullable-int64u"); AddArgument("attr-value", 0, UINT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableInt64u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt64u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedLongLong:mValue.Value()]; } [cluster writeAttributeNullableInt64uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableInt64u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableInt64u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableInt64u() : SubscribeAttribute("nullable-int64u") { } ~SubscribeAttributeUnitTestingNullableInt64u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt64u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableInt64uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt64u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableInt8s */ class ReadUnitTestingNullableInt8s : public ReadAttribute { public: ReadUnitTestingNullableInt8s() : ReadAttribute("nullable-int8s") { } ~ReadUnitTestingNullableInt8s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt8s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableInt8sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt8s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableInt8s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableInt8s : public WriteAttribute { public: WriteUnitTestingNullableInt8s() : WriteAttribute("nullable-int8s") { AddArgument("attr-name", "nullable-int8s"); AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableInt8s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt8s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithChar:mValue.Value()]; } [cluster writeAttributeNullableInt8sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableInt8s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableInt8s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableInt8s() : SubscribeAttribute("nullable-int8s") { } ~SubscribeAttributeUnitTestingNullableInt8s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt8s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableInt8sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt8s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableInt16s */ class ReadUnitTestingNullableInt16s : public ReadAttribute { public: ReadUnitTestingNullableInt16s() : ReadAttribute("nullable-int16s") { } ~ReadUnitTestingNullableInt16s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt16s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableInt16sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt16s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableInt16s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableInt16s : public WriteAttribute { public: WriteUnitTestingNullableInt16s() : WriteAttribute("nullable-int16s") { AddArgument("attr-name", "nullable-int16s"); AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableInt16s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt16s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithShort:mValue.Value()]; } [cluster writeAttributeNullableInt16sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableInt16s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableInt16s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableInt16s() : SubscribeAttribute("nullable-int16s") { } ~SubscribeAttributeUnitTestingNullableInt16s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt16s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableInt16sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt16s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableInt24s */ class ReadUnitTestingNullableInt24s : public ReadAttribute { public: ReadUnitTestingNullableInt24s() : ReadAttribute("nullable-int24s") { } ~ReadUnitTestingNullableInt24s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt24s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableInt24sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt24s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableInt24s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableInt24s : public WriteAttribute { public: WriteUnitTestingNullableInt24s() : WriteAttribute("nullable-int24s") { AddArgument("attr-name", "nullable-int24s"); AddArgument("attr-value", INT32_MIN, INT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableInt24s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt24s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithInt:mValue.Value()]; } [cluster writeAttributeNullableInt24sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableInt24s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableInt24s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableInt24s() : SubscribeAttribute("nullable-int24s") { } ~SubscribeAttributeUnitTestingNullableInt24s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt24s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableInt24sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt24s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableInt32s */ class ReadUnitTestingNullableInt32s : public ReadAttribute { public: ReadUnitTestingNullableInt32s() : ReadAttribute("nullable-int32s") { } ~ReadUnitTestingNullableInt32s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt32s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableInt32sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt32s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableInt32s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableInt32s : public WriteAttribute { public: WriteUnitTestingNullableInt32s() : WriteAttribute("nullable-int32s") { AddArgument("attr-name", "nullable-int32s"); AddArgument("attr-value", INT32_MIN, INT32_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableInt32s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt32s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithInt:mValue.Value()]; } [cluster writeAttributeNullableInt32sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableInt32s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableInt32s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableInt32s() : SubscribeAttribute("nullable-int32s") { } ~SubscribeAttributeUnitTestingNullableInt32s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt32s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableInt32sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt32s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableInt40s */ class ReadUnitTestingNullableInt40s : public ReadAttribute { public: ReadUnitTestingNullableInt40s() : ReadAttribute("nullable-int40s") { } ~ReadUnitTestingNullableInt40s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt40s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableInt40sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt40s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableInt40s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableInt40s : public WriteAttribute { public: WriteUnitTestingNullableInt40s() : WriteAttribute("nullable-int40s") { AddArgument("attr-name", "nullable-int40s"); AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableInt40s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt40s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithLongLong:mValue.Value()]; } [cluster writeAttributeNullableInt40sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableInt40s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableInt40s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableInt40s() : SubscribeAttribute("nullable-int40s") { } ~SubscribeAttributeUnitTestingNullableInt40s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt40s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableInt40sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt40s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableInt48s */ class ReadUnitTestingNullableInt48s : public ReadAttribute { public: ReadUnitTestingNullableInt48s() : ReadAttribute("nullable-int48s") { } ~ReadUnitTestingNullableInt48s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt48s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableInt48sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt48s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableInt48s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableInt48s : public WriteAttribute { public: WriteUnitTestingNullableInt48s() : WriteAttribute("nullable-int48s") { AddArgument("attr-name", "nullable-int48s"); AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableInt48s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt48s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithLongLong:mValue.Value()]; } [cluster writeAttributeNullableInt48sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableInt48s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableInt48s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableInt48s() : SubscribeAttribute("nullable-int48s") { } ~SubscribeAttributeUnitTestingNullableInt48s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt48s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableInt48sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt48s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableInt56s */ class ReadUnitTestingNullableInt56s : public ReadAttribute { public: ReadUnitTestingNullableInt56s() : ReadAttribute("nullable-int56s") { } ~ReadUnitTestingNullableInt56s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt56s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableInt56sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt56s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableInt56s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableInt56s : public WriteAttribute { public: WriteUnitTestingNullableInt56s() : WriteAttribute("nullable-int56s") { AddArgument("attr-name", "nullable-int56s"); AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableInt56s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt56s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithLongLong:mValue.Value()]; } [cluster writeAttributeNullableInt56sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableInt56s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableInt56s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableInt56s() : SubscribeAttribute("nullable-int56s") { } ~SubscribeAttributeUnitTestingNullableInt56s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt56s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableInt56sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt56s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableInt64s */ class ReadUnitTestingNullableInt64s : public ReadAttribute { public: ReadUnitTestingNullableInt64s() : ReadAttribute("nullable-int64s") { } ~ReadUnitTestingNullableInt64s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt64s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableInt64sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt64s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableInt64s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableInt64s : public WriteAttribute { public: WriteUnitTestingNullableInt64s() : WriteAttribute("nullable-int64s") { AddArgument("attr-name", "nullable-int64s"); AddArgument("attr-value", INT64_MIN, INT64_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableInt64s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt64s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithLongLong:mValue.Value()]; } [cluster writeAttributeNullableInt64sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableInt64s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableInt64s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableInt64s() : SubscribeAttribute("nullable-int64s") { } ~SubscribeAttributeUnitTestingNullableInt64s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableInt64s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableInt64sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableInt64s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableEnum8 */ class ReadUnitTestingNullableEnum8 : public ReadAttribute { public: ReadUnitTestingNullableEnum8() : ReadAttribute("nullable-enum8") { } ~ReadUnitTestingNullableEnum8() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableEnum8::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableEnum8WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableEnum8 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableEnum8 read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableEnum8 : public WriteAttribute { public: WriteUnitTestingNullableEnum8() : WriteAttribute("nullable-enum8") { AddArgument("attr-name", "nullable-enum8"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableEnum8() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableEnum8::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeNullableEnum8WithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableEnum8 write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableEnum8 : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableEnum8() : SubscribeAttribute("nullable-enum8") { } ~SubscribeAttributeUnitTestingNullableEnum8() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableEnum8::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableEnum8WithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableEnum8 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableEnum16 */ class ReadUnitTestingNullableEnum16 : public ReadAttribute { public: ReadUnitTestingNullableEnum16() : ReadAttribute("nullable-enum16") { } ~ReadUnitTestingNullableEnum16() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableEnum16::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableEnum16WithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableEnum16 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableEnum16 read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableEnum16 : public WriteAttribute { public: WriteUnitTestingNullableEnum16() : WriteAttribute("nullable-enum16") { AddArgument("attr-name", "nullable-enum16"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableEnum16() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableEnum16::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedShort:mValue.Value()]; } [cluster writeAttributeNullableEnum16WithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableEnum16 write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableEnum16 : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableEnum16() : SubscribeAttribute("nullable-enum16") { } ~SubscribeAttributeUnitTestingNullableEnum16() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableEnum16::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableEnum16WithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableEnum16 response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableFloatSingle */ class ReadUnitTestingNullableFloatSingle : public ReadAttribute { public: ReadUnitTestingNullableFloatSingle() : ReadAttribute("nullable-float-single") { } ~ReadUnitTestingNullableFloatSingle() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableFloatSingle::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableFloatSingleWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableFloatSingle response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableFloatSingle read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableFloatSingle : public WriteAttribute { public: WriteUnitTestingNullableFloatSingle() : WriteAttribute("nullable-float-single") { AddArgument("attr-name", "nullable-float-single"); AddArgument("attr-value", -std::numeric_limits::infinity(), std::numeric_limits::infinity(), &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableFloatSingle() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableFloatSingle::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithFloat:mValue.Value()]; } [cluster writeAttributeNullableFloatSingleWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableFloatSingle write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableFloatSingle : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableFloatSingle() : SubscribeAttribute("nullable-float-single") { } ~SubscribeAttributeUnitTestingNullableFloatSingle() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableFloatSingle::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableFloatSingleWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableFloatSingle response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableFloatDouble */ class ReadUnitTestingNullableFloatDouble : public ReadAttribute { public: ReadUnitTestingNullableFloatDouble() : ReadAttribute("nullable-float-double") { } ~ReadUnitTestingNullableFloatDouble() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableFloatDouble::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableFloatDoubleWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableFloatDouble response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableFloatDouble read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableFloatDouble : public WriteAttribute { public: WriteUnitTestingNullableFloatDouble() : WriteAttribute("nullable-float-double") { AddArgument("attr-name", "nullable-float-double"); AddArgument("attr-value", -std::numeric_limits::infinity(), std::numeric_limits::infinity(), &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableFloatDouble() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableFloatDouble::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithDouble:mValue.Value()]; } [cluster writeAttributeNullableFloatDoubleWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableFloatDouble write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableFloatDouble : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableFloatDouble() : SubscribeAttribute("nullable-float-double") { } ~SubscribeAttributeUnitTestingNullableFloatDouble() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableFloatDouble::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableFloatDoubleWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableFloatDouble response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableOctetString */ class ReadUnitTestingNullableOctetString : public ReadAttribute { public: ReadUnitTestingNullableOctetString() : ReadAttribute("nullable-octet-string") { } ~ReadUnitTestingNullableOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableOctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableOctetStringWithCompletion:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableOctetString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableOctetString read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableOctetString : public WriteAttribute { public: WriteUnitTestingNullableOctetString() : WriteAttribute("nullable-octet-string") { AddArgument("attr-name", "nullable-octet-string"); AddArgument("attr-value", &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableOctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSData * _Nullable value = nil; if (!mValue.IsNull()) { value = [[NSData alloc] initWithBytes:mValue.Value().data() length:mValue.Value().size()]; } [cluster writeAttributeNullableOctetStringWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableOctetString write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableOctetString : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableOctetString() : SubscribeAttribute("nullable-octet-string") { } ~SubscribeAttributeUnitTestingNullableOctetString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableOctetString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableOctetStringWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableOctetString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableCharString */ class ReadUnitTestingNullableCharString : public ReadAttribute { public: ReadUnitTestingNullableCharString() : ReadAttribute("nullable-char-string") { } ~ReadUnitTestingNullableCharString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableCharString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableCharStringWithCompletion:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableCharString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableCharString read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableCharString : public WriteAttribute { public: WriteUnitTestingNullableCharString() : WriteAttribute("nullable-char-string") { AddArgument("attr-name", "nullable-char-string"); AddArgument("attr-value", &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableCharString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableCharString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSString * _Nullable value = nil; if (!mValue.IsNull()) { value = [[NSString alloc] initWithBytes:mValue.Value().data() length:mValue.Value().size() encoding:NSUTF8StringEncoding]; } [cluster writeAttributeNullableCharStringWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableCharString write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableCharString : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableCharString() : SubscribeAttribute("nullable-char-string") { } ~SubscribeAttributeUnitTestingNullableCharString() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableCharString::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableCharStringWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableCharString response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableEnumAttr */ class ReadUnitTestingNullableEnumAttr : public ReadAttribute { public: ReadUnitTestingNullableEnumAttr() : ReadAttribute("nullable-enum-attr") { } ~ReadUnitTestingNullableEnumAttr() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableEnumAttr::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableEnumAttrWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableEnumAttr response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableEnumAttr read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableEnumAttr : public WriteAttribute { public: WriteUnitTestingNullableEnumAttr() : WriteAttribute("nullable-enum-attr") { AddArgument("attr-name", "nullable-enum-attr"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableEnumAttr() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableEnumAttr::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeNullableEnumAttrWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableEnumAttr write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableEnumAttr : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableEnumAttr() : SubscribeAttribute("nullable-enum-attr") { } ~SubscribeAttributeUnitTestingNullableEnumAttr() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableEnumAttr::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableEnumAttrWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableEnumAttr response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableStruct */ class ReadUnitTestingNullableStruct : public ReadAttribute { public: ReadUnitTestingNullableStruct() : ReadAttribute("nullable-struct") { } ~ReadUnitTestingNullableStruct() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableStruct::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableStructWithCompletion:^(MTRUnitTestingClusterSimpleStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableStruct response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableStruct read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableStruct : public WriteAttribute { public: WriteUnitTestingNullableStruct() : WriteAttribute("nullable-struct") , mComplex(&mValue) { AddArgument("attr-name", "nullable-struct"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableStruct() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableStruct::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; MTRUnitTestingClusterSimpleStruct * _Nullable value; if (mValue.IsNull()) { value = nil; } else { value = [MTRUnitTestingClusterSimpleStruct new]; value.a = [NSNumber numberWithUnsignedChar:mValue.Value().a]; value.b = [NSNumber numberWithBool:mValue.Value().b]; value.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(mValue.Value().c)]; value.d = [NSData dataWithBytes:mValue.Value().d.data() length:mValue.Value().d.size()]; value.e = [[NSString alloc] initWithBytes:mValue.Value().e.data() length:mValue.Value().e.size() encoding:NSUTF8StringEncoding]; value.f = [NSNumber numberWithUnsignedChar:mValue.Value().f.Raw()]; value.g = [NSNumber numberWithFloat:mValue.Value().g]; value.h = [NSNumber numberWithDouble:mValue.Value().h]; if (mValue.Value().i.HasValue()) { value.i = [NSNumber numberWithUnsignedChar:chip::to_underlying(mValue.Value().i.Value())]; } else { value.i = nil; } } [cluster writeAttributeNullableStructWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableStruct write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeUnitTestingNullableStruct : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableStruct() : SubscribeAttribute("nullable-struct") { } ~SubscribeAttributeUnitTestingNullableStruct() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableStruct::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableStructWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRUnitTestingClusterSimpleStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableStruct response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableRangeRestrictedInt8u */ class ReadUnitTestingNullableRangeRestrictedInt8u : public ReadAttribute { public: ReadUnitTestingNullableRangeRestrictedInt8u() : ReadAttribute("nullable-range-restricted-int8u") { } ~ReadUnitTestingNullableRangeRestrictedInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableRangeRestrictedInt8uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableRangeRestrictedInt8u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableRangeRestrictedInt8u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableRangeRestrictedInt8u : public WriteAttribute { public: WriteUnitTestingNullableRangeRestrictedInt8u() : WriteAttribute("nullable-range-restricted-int8u") { AddArgument("attr-name", "nullable-range-restricted-int8u"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableRangeRestrictedInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeNullableRangeRestrictedInt8uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableRangeRestrictedInt8u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableRangeRestrictedInt8u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableRangeRestrictedInt8u() : SubscribeAttribute("nullable-range-restricted-int8u") { } ~SubscribeAttributeUnitTestingNullableRangeRestrictedInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableRangeRestrictedInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableRangeRestrictedInt8uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableRangeRestrictedInt8u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableRangeRestrictedInt8s */ class ReadUnitTestingNullableRangeRestrictedInt8s : public ReadAttribute { public: ReadUnitTestingNullableRangeRestrictedInt8s() : ReadAttribute("nullable-range-restricted-int8s") { } ~ReadUnitTestingNullableRangeRestrictedInt8s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableRangeRestrictedInt8sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableRangeRestrictedInt8s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableRangeRestrictedInt8s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableRangeRestrictedInt8s : public WriteAttribute { public: WriteUnitTestingNullableRangeRestrictedInt8s() : WriteAttribute("nullable-range-restricted-int8s") { AddArgument("attr-name", "nullable-range-restricted-int8s"); AddArgument("attr-value", INT8_MIN, INT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableRangeRestrictedInt8s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithChar:mValue.Value()]; } [cluster writeAttributeNullableRangeRestrictedInt8sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableRangeRestrictedInt8s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableRangeRestrictedInt8s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableRangeRestrictedInt8s() : SubscribeAttribute("nullable-range-restricted-int8s") { } ~SubscribeAttributeUnitTestingNullableRangeRestrictedInt8s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableRangeRestrictedInt8s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableRangeRestrictedInt8sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableRangeRestrictedInt8s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableRangeRestrictedInt16u */ class ReadUnitTestingNullableRangeRestrictedInt16u : public ReadAttribute { public: ReadUnitTestingNullableRangeRestrictedInt16u() : ReadAttribute("nullable-range-restricted-int16u") { } ~ReadUnitTestingNullableRangeRestrictedInt16u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableRangeRestrictedInt16uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableRangeRestrictedInt16u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableRangeRestrictedInt16u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableRangeRestrictedInt16u : public WriteAttribute { public: WriteUnitTestingNullableRangeRestrictedInt16u() : WriteAttribute("nullable-range-restricted-int16u") { AddArgument("attr-name", "nullable-range-restricted-int16u"); AddArgument("attr-value", 0, UINT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableRangeRestrictedInt16u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedShort:mValue.Value()]; } [cluster writeAttributeNullableRangeRestrictedInt16uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableRangeRestrictedInt16u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableRangeRestrictedInt16u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableRangeRestrictedInt16u() : SubscribeAttribute("nullable-range-restricted-int16u") { } ~SubscribeAttributeUnitTestingNullableRangeRestrictedInt16u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableRangeRestrictedInt16u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableRangeRestrictedInt16uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableRangeRestrictedInt16u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute NullableRangeRestrictedInt16s */ class ReadUnitTestingNullableRangeRestrictedInt16s : public ReadAttribute { public: ReadUnitTestingNullableRangeRestrictedInt16s() : ReadAttribute("nullable-range-restricted-int16s") { } ~ReadUnitTestingNullableRangeRestrictedInt16s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableRangeRestrictedInt16sWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableRangeRestrictedInt16s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableRangeRestrictedInt16s read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableRangeRestrictedInt16s : public WriteAttribute { public: WriteUnitTestingNullableRangeRestrictedInt16s() : WriteAttribute("nullable-range-restricted-int16s") { AddArgument("attr-name", "nullable-range-restricted-int16s"); AddArgument("attr-value", INT16_MIN, INT16_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableRangeRestrictedInt16s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithShort:mValue.Value()]; } [cluster writeAttributeNullableRangeRestrictedInt16sWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableRangeRestrictedInt16s write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableRangeRestrictedInt16s : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableRangeRestrictedInt16s() : SubscribeAttribute("nullable-range-restricted-int16s") { } ~SubscribeAttributeUnitTestingNullableRangeRestrictedInt16s() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableRangeRestrictedInt16s::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableRangeRestrictedInt16sWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableRangeRestrictedInt16s response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute WriteOnlyInt8u */ class ReadUnitTestingWriteOnlyInt8u : public ReadAttribute { public: ReadUnitTestingWriteOnlyInt8u() : ReadAttribute("write-only-int8u") { } ~ReadUnitTestingWriteOnlyInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::WriteOnlyInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeWriteOnlyInt8uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.WriteOnlyInt8u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting WriteOnlyInt8u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingWriteOnlyInt8u : public WriteAttribute { public: WriteUnitTestingWriteOnlyInt8u() : WriteAttribute("write-only-int8u") { AddArgument("attr-name", "write-only-int8u"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingWriteOnlyInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::WriteOnlyInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeWriteOnlyInt8uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting WriteOnlyInt8u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeUnitTestingWriteOnlyInt8u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingWriteOnlyInt8u() : SubscribeAttribute("write-only-int8u") { } ~SubscribeAttributeUnitTestingWriteOnlyInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::WriteOnlyInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeWriteOnlyInt8uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.WriteOnlyInt8u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute NullableGlobalEnum */ class ReadUnitTestingNullableGlobalEnum : public ReadAttribute { public: ReadUnitTestingNullableGlobalEnum() : ReadAttribute("nullable-global-enum") { } ~ReadUnitTestingNullableGlobalEnum() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableGlobalEnum::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableGlobalEnumWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableGlobalEnum response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableGlobalEnum read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableGlobalEnum : public WriteAttribute { public: WriteUnitTestingNullableGlobalEnum() : WriteAttribute("nullable-global-enum") { AddArgument("attr-name", "nullable-global-enum"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableGlobalEnum() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableGlobalEnum::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nullable value = nil; if (!mValue.IsNull()) { value = [NSNumber numberWithUnsignedChar:mValue.Value()]; } [cluster writeAttributeNullableGlobalEnumWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableGlobalEnum write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; }; class SubscribeAttributeUnitTestingNullableGlobalEnum : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableGlobalEnum() : SubscribeAttribute("nullable-global-enum") { } ~SubscribeAttributeUnitTestingNullableGlobalEnum() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableGlobalEnum::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableGlobalEnumWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableGlobalEnum response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute NullableGlobalStruct */ class ReadUnitTestingNullableGlobalStruct : public ReadAttribute { public: ReadUnitTestingNullableGlobalStruct() : ReadAttribute("nullable-global-struct") { } ~ReadUnitTestingNullableGlobalStruct() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableGlobalStruct::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeNullableGlobalStructWithCompletion:^(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableGlobalStruct response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting NullableGlobalStruct read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingNullableGlobalStruct : public WriteAttribute { public: WriteUnitTestingNullableGlobalStruct() : WriteAttribute("nullable-global-struct") , mComplex(&mValue) { AddArgument("attr-name", "nullable-global-struct"); AddArgument("attr-value", &mComplex); WriteAttribute::AddArguments(); } ~WriteUnitTestingNullableGlobalStruct() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableGlobalStruct::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; MTRDataTypeTestGlobalStruct * _Nullable value; if (mValue.IsNull()) { value = nil; } else { value = [MTRDataTypeTestGlobalStruct new]; value.name = [[NSString alloc] initWithBytes:mValue.Value().name.data() length:mValue.Value().name.size() encoding:NSUTF8StringEncoding]; if (mValue.Value().myBitmap.IsNull()) { value.myBitmap = nil; } else { value.myBitmap = [NSNumber numberWithUnsignedInt:mValue.Value().myBitmap.Value().Raw()]; } if (mValue.Value().myEnum.HasValue()) { if (mValue.Value().myEnum.Value().IsNull()) { value.myEnum = nil; } else { value.myEnum = [NSNumber numberWithUnsignedChar:chip::to_underlying(mValue.Value().myEnum.Value().Value())]; } } else { value.myEnum = nil; } } [cluster writeAttributeNullableGlobalStructWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting NullableGlobalStruct write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: chip::app::DataModel::Nullable mValue; TypedComplexArgument> mComplex; }; class SubscribeAttributeUnitTestingNullableGlobalStruct : public SubscribeAttribute { public: SubscribeAttributeUnitTestingNullableGlobalStruct() : SubscribeAttribute("nullable-global-struct") { } ~SubscribeAttributeUnitTestingNullableGlobalStruct() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::NullableGlobalStruct::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeNullableGlobalStructWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(MTRDataTypeTestGlobalStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.NullableGlobalStruct response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadUnitTestingGeneratedCommandList : public ReadAttribute { public: ReadUnitTestingGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadUnitTestingGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUnitTestingGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeUnitTestingGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeUnitTestingGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute AcceptedCommandList */ class ReadUnitTestingAcceptedCommandList : public ReadAttribute { public: ReadUnitTestingAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadUnitTestingAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUnitTestingAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeUnitTestingAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeUnitTestingAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadUnitTestingEventList : public ReadAttribute { public: ReadUnitTestingEventList() : ReadAttribute("event-list") { } ~ReadUnitTestingEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUnitTestingEventList : public SubscribeAttribute { public: SubscribeAttributeUnitTestingEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeUnitTestingEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadUnitTestingAttributeList : public ReadAttribute { public: ReadUnitTestingAttributeList() : ReadAttribute("attribute-list") { } ~ReadUnitTestingAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUnitTestingAttributeList : public SubscribeAttribute { public: SubscribeAttributeUnitTestingAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeUnitTestingAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute FeatureMap */ class ReadUnitTestingFeatureMap : public ReadAttribute { public: ReadUnitTestingFeatureMap() : ReadAttribute("feature-map") { } ~ReadUnitTestingFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUnitTestingFeatureMap : public SubscribeAttribute { public: SubscribeAttributeUnitTestingFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeUnitTestingFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; /* * Attribute ClusterRevision */ class ReadUnitTestingClusterRevision : public ReadAttribute { public: ReadUnitTestingClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadUnitTestingClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeUnitTestingClusterRevision : public SubscribeAttribute { public: SubscribeAttributeUnitTestingClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeUnitTestingClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #if MTR_ENABLE_PROVISIONAL /* * Attribute MeiInt8u */ class ReadUnitTestingMeiInt8u : public ReadAttribute { public: ReadUnitTestingMeiInt8u() : ReadAttribute("mei-int8u") { } ~ReadUnitTestingMeiInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::MeiInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeMeiInt8uWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.MeiInt8u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("UnitTesting MeiInt8u read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteUnitTestingMeiInt8u : public WriteAttribute { public: WriteUnitTestingMeiInt8u() : WriteAttribute("mei-int8u") { AddArgument("attr-name", "mei-int8u"); AddArgument("attr-value", 0, UINT8_MAX, &mValue); WriteAttribute::AddArguments(); } ~WriteUnitTestingMeiInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::UnitTesting::Attributes::MeiInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; [cluster writeAttributeMeiInt8uWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("UnitTesting MeiInt8u write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: uint8_t mValue; }; class SubscribeAttributeUnitTestingMeiInt8u : public SubscribeAttribute { public: SubscribeAttributeUnitTestingMeiInt8u() : SubscribeAttribute("mei-int8u") { } ~SubscribeAttributeUnitTestingMeiInt8u() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::UnitTesting::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::UnitTesting::Attributes::MeiInt8u::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeMeiInt8uWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitTesting.MeiInt8u response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Cluster SampleMei | 0xFFF1FC20 | |------------------------------------------------------------------------------| | Commands: | | | * Ping | 0x00 | | * AddArguments | 0x02 | |------------------------------------------------------------------------------| | Attributes: | | | * FlipFlop | 0x0000 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | | * AttributeList | 0xFFFB | | * FeatureMap | 0xFFFC | | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | | * PingCountEvent | 0x0000 | \*----------------------------------------------------------------------------*/ #if MTR_ENABLE_PROVISIONAL /* * Command Ping */ class SampleMeiPing : public ClusterCommand { public: SampleMeiPing() : ClusterCommand("ping") { ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::CommandId commandId = chip::app::Clusters::SampleMei::Commands::Ping::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSampleMEIClusterPingParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster pingWithParams:params completion: ^(NSError * _Nullable error) { responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(commandId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Command AddArguments */ class SampleMeiAddArguments : public ClusterCommand { public: SampleMeiAddArguments() : ClusterCommand("add-arguments") { #if MTR_ENABLE_PROVISIONAL AddArgument("Arg1", 0, UINT8_MAX, &mRequest.arg1); #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL AddArgument("Arg2", 0, UINT8_MAX, &mRequest.arg2); #endif // MTR_ENABLE_PROVISIONAL ClusterCommand::AddArguments(); } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::CommandId commandId = chip::app::Clusters::SampleMei::Commands::AddArguments::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") command (0x%08" PRIX32 ") on endpoint %u", clusterId, commandId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSampleMEIClusterAddArgumentsParams alloc] init]; params.timedInvokeTimeoutMs = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; #if MTR_ENABLE_PROVISIONAL params.arg1 = [NSNumber numberWithUnsignedChar:mRequest.arg1]; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL params.arg2 = [NSNumber numberWithUnsignedChar:mRequest.arg2]; #endif // MTR_ENABLE_PROVISIONAL uint16_t repeatCount = mRepeatCount.ValueOr(1); uint16_t __block responsesNeeded = repeatCount; while (repeatCount--) { [cluster addArgumentsWithParams:params completion: ^(MTRSampleMEIClusterAddArgumentsResponseParams * _Nullable values, NSError * _Nullable error) { NSLog(@"Values: %@", values); if (error == nil) { constexpr chip::CommandId responseId = chip::app::Clusters::SampleMei::Commands::AddArgumentsResponse::Id; RemoteDataModelLogger::LogCommandAsJSON(@(endpointId), @(clusterId), @(responseId), values); } responsesNeeded--; if (error != nil) { mError = error; LogNSError("Error", error); constexpr chip::CommandId responseId = chip::app::Clusters::SampleMei::Commands::AddArgumentsResponse::Id; RemoteDataModelLogger::LogCommandErrorAsJSON(@(endpointId), @(clusterId), @(responseId), error); } if (responsesNeeded == 0) { SetCommandExitStatus(mError); } }]; } return CHIP_NO_ERROR; } private: chip::app::Clusters::SampleMei::Commands::AddArguments::Type mRequest; }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FlipFlop */ class ReadSampleMeiFlipFlop : public ReadAttribute { public: ReadSampleMeiFlipFlop() : ReadAttribute("flip-flop") { } ~ReadSampleMeiFlipFlop() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SampleMei::Attributes::FlipFlop::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFlipFlopWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SampleMEI.FlipFlop response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SampleMEI FlipFlop read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class WriteSampleMeiFlipFlop : public WriteAttribute { public: WriteSampleMeiFlipFlop() : WriteAttribute("flip-flop") { AddArgument("attr-name", "flip-flop"); AddArgument("attr-value", 0, 1, &mValue); WriteAttribute::AddArguments(); } ~WriteSampleMeiFlipFlop() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SampleMei::Attributes::FlipFlop::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") WriteAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRWriteParams alloc] init]; params.timedWriteTimeout = mTimedInteractionTimeoutMs.HasValue() ? [NSNumber numberWithUnsignedShort:mTimedInteractionTimeoutMs.Value()] : nil; params.dataVersion = mDataVersion.HasValue() ? [NSNumber numberWithUnsignedInt:mDataVersion.Value()] : nil; NSNumber * _Nonnull value = [NSNumber numberWithBool:mValue]; [cluster writeAttributeFlipFlopWithValue:value params:params completion:^(NSError * _Nullable error) { if (error != nil) { LogNSError("SampleMEI FlipFlop write Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } private: bool mValue; }; class SubscribeAttributeSampleMeiFlipFlop : public SubscribeAttribute { public: SubscribeAttributeSampleMeiFlipFlop() : SubscribeAttribute("flip-flop") { } ~SubscribeAttributeSampleMeiFlipFlop() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SampleMei::Attributes::FlipFlop::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFlipFlopWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SampleMEI.FlipFlop response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute GeneratedCommandList */ class ReadSampleMeiGeneratedCommandList : public ReadAttribute { public: ReadSampleMeiGeneratedCommandList() : ReadAttribute("generated-command-list") { } ~ReadSampleMeiGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SampleMei::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SampleMEI.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SampleMEI GeneratedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSampleMeiGeneratedCommandList : public SubscribeAttribute { public: SubscribeAttributeSampleMeiGeneratedCommandList() : SubscribeAttribute("generated-command-list") { } ~SubscribeAttributeSampleMeiGeneratedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SampleMei::Attributes::GeneratedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeGeneratedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SampleMEI.GeneratedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AcceptedCommandList */ class ReadSampleMeiAcceptedCommandList : public ReadAttribute { public: ReadSampleMeiAcceptedCommandList() : ReadAttribute("accepted-command-list") { } ~ReadSampleMeiAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SampleMei::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SampleMEI.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SampleMEI AcceptedCommandList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSampleMeiAcceptedCommandList : public SubscribeAttribute { public: SubscribeAttributeSampleMeiAcceptedCommandList() : SubscribeAttribute("accepted-command-list") { } ~SubscribeAttributeSampleMeiAcceptedCommandList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SampleMei::Attributes::AcceptedCommandList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAcceptedCommandListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SampleMEI.AcceptedCommandList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute EventList */ class ReadSampleMeiEventList : public ReadAttribute { public: ReadSampleMeiEventList() : ReadAttribute("event-list") { } ~ReadSampleMeiEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SampleMei::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SampleMEI.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SampleMEI EventList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSampleMeiEventList : public SubscribeAttribute { public: SubscribeAttributeSampleMeiEventList() : SubscribeAttribute("event-list") { } ~SubscribeAttributeSampleMeiEventList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SampleMei::Attributes::EventList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeEventListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SampleMEI.EventList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute AttributeList */ class ReadSampleMeiAttributeList : public ReadAttribute { public: ReadSampleMeiAttributeList() : ReadAttribute("attribute-list") { } ~ReadSampleMeiAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SampleMei::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SampleMEI.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SampleMEI AttributeList read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSampleMeiAttributeList : public SubscribeAttribute { public: SubscribeAttributeSampleMeiAttributeList() : SubscribeAttribute("attribute-list") { } ~SubscribeAttributeSampleMeiAttributeList() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SampleMei::Attributes::AttributeList::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeAttributeListWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SampleMEI.AttributeList response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute FeatureMap */ class ReadSampleMeiFeatureMap : public ReadAttribute { public: ReadSampleMeiFeatureMap() : ReadAttribute("feature-map") { } ~ReadSampleMeiFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SampleMei::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SampleMEI.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SampleMEI FeatureMap read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSampleMeiFeatureMap : public SubscribeAttribute { public: SubscribeAttributeSampleMeiFeatureMap() : SubscribeAttribute("feature-map") { } ~SubscribeAttributeSampleMeiFeatureMap() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SampleMei::Attributes::FeatureMap::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeFeatureMapWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SampleMEI.FeatureMap response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL /* * Attribute ClusterRevision */ class ReadSampleMeiClusterRevision : public ReadAttribute { public: ReadSampleMeiClusterRevision() : ReadAttribute("cluster-revision") { } ~ReadSampleMeiClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::AttributeId attributeId = chip::app::Clusters::SampleMei::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReadAttribute (0x%08" PRIX32 ") on endpoint %u", endpointId, clusterId, attributeId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SampleMEI.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { LogNSError("SampleMEI ClusterRevision read Error", error); RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; class SubscribeAttributeSampleMeiClusterRevision : public SubscribeAttribute { public: SubscribeAttributeSampleMeiClusterRevision() : SubscribeAttribute("cluster-revision") { } ~SubscribeAttributeSampleMeiClusterRevision() { } CHIP_ERROR SendCommand(MTRBaseDevice * device, chip::EndpointId endpointId) override { constexpr chip::ClusterId clusterId = chip::app::Clusters::SampleMei::Id; constexpr chip::CommandId attributeId = chip::app::Clusters::SampleMei::Attributes::ClusterRevision::Id; ChipLogProgress(chipTool, "Sending cluster (0x%08" PRIX32 ") ReportAttribute (0x%08" PRIX32 ") on endpoint %u", clusterId, attributeId, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); __auto_type * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:device endpointID:@(endpointId) queue:callbackQueue]; __auto_type * params = [[MTRSubscribeParams alloc] initWithMinInterval:@(mMinInterval) maxInterval:@(mMaxInterval)]; if (mKeepSubscriptions.HasValue()) { params.replaceExistingSubscriptions = !mKeepSubscriptions.Value(); } if (mFabricFiltered.HasValue()) { params.filterByFabric = mFabricFiltered.Value(); } if (mAutoResubscribe.HasValue()) { params.resubscribeAutomatically = mAutoResubscribe.Value(); } [cluster subscribeAttributeClusterRevisionWithParams:params subscriptionEstablished:^() { mSubscriptionEstablished = YES; } reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SampleMEI.ClusterRevision response %@", [value description]); if (error == nil) { RemoteDataModelLogger::LogAttributeAsJSON(@(endpointId), @(clusterId), @(attributeId), value); } else { RemoteDataModelLogger::LogAttributeErrorAsJSON(@(endpointId), @(clusterId), @(attributeId), error); } SetCommandExitStatus(error); }]; return CHIP_NO_ERROR; } }; #endif // MTR_ENABLE_PROVISIONAL #endif // MTR_ENABLE_PROVISIONAL /*----------------------------------------------------------------------------*\ | Register all Clusters commands | \*----------------------------------------------------------------------------*/ void registerClusterIdentify(Commands & commands) { using namespace chip::app::Clusters::Identify; const char * clusterName = "Identify"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterGroups(Commands & commands) { using namespace chip::app::Clusters::Groups; const char * clusterName = "Groups"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOnOff(Commands & commands) { using namespace chip::app::Clusters::OnOff; const char * clusterName = "OnOff"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterLevelControl(Commands & commands) { using namespace chip::app::Clusters::LevelControl; const char * clusterName = "LevelControl"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPulseWidthModulation(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::PulseWidthModulation; const char * clusterName = "PulseWidthModulation"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterDescriptor(Commands & commands) { using namespace chip::app::Clusters::Descriptor; const char * clusterName = "Descriptor"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBinding(Commands & commands) { using namespace chip::app::Clusters::Binding; const char * clusterName = "Binding"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterAccessControl(Commands & commands) { using namespace chip::app::Clusters::AccessControl; const char * clusterName = "AccessControl"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterActions(Commands & commands) { using namespace chip::app::Clusters::Actions; const char * clusterName = "Actions"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBasicInformation(Commands & commands) { using namespace chip::app::Clusters::BasicInformation; const char * clusterName = "BasicInformation"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOtaSoftwareUpdateProvider(Commands & commands) { using namespace chip::app::Clusters::OtaSoftwareUpdateProvider; const char * clusterName = "OtaSoftwareUpdateProvider"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOtaSoftwareUpdateRequestor(Commands & commands) { using namespace chip::app::Clusters::OtaSoftwareUpdateRequestor; const char * clusterName = "OtaSoftwareUpdateRequestor"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterLocalizationConfiguration(Commands & commands) { using namespace chip::app::Clusters::LocalizationConfiguration; const char * clusterName = "LocalizationConfiguration"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTimeFormatLocalization(Commands & commands) { using namespace chip::app::Clusters::TimeFormatLocalization; const char * clusterName = "TimeFormatLocalization"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterUnitLocalization(Commands & commands) { using namespace chip::app::Clusters::UnitLocalization; const char * clusterName = "UnitLocalization"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPowerSourceConfiguration(Commands & commands) { using namespace chip::app::Clusters::PowerSourceConfiguration; const char * clusterName = "PowerSourceConfiguration"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPowerSource(Commands & commands) { using namespace chip::app::Clusters::PowerSource; const char * clusterName = "PowerSource"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterGeneralCommissioning(Commands & commands) { using namespace chip::app::Clusters::GeneralCommissioning; const char * clusterName = "GeneralCommissioning"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterNetworkCommissioning(Commands & commands) { using namespace chip::app::Clusters::NetworkCommissioning; const char * clusterName = "NetworkCommissioning"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterDiagnosticLogs(Commands & commands) { using namespace chip::app::Clusters::DiagnosticLogs; const char * clusterName = "DiagnosticLogs"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterGeneralDiagnostics(Commands & commands) { using namespace chip::app::Clusters::GeneralDiagnostics; const char * clusterName = "GeneralDiagnostics"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterSoftwareDiagnostics(Commands & commands) { using namespace chip::app::Clusters::SoftwareDiagnostics; const char * clusterName = "SoftwareDiagnostics"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterThreadNetworkDiagnostics(Commands & commands) { using namespace chip::app::Clusters::ThreadNetworkDiagnostics; const char * clusterName = "ThreadNetworkDiagnostics"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterWiFiNetworkDiagnostics(Commands & commands) { using namespace chip::app::Clusters::WiFiNetworkDiagnostics; const char * clusterName = "WiFiNetworkDiagnostics"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterEthernetNetworkDiagnostics(Commands & commands) { using namespace chip::app::Clusters::EthernetNetworkDiagnostics; const char * clusterName = "EthernetNetworkDiagnostics"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTimeSynchronization(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::TimeSynchronization; const char * clusterName = "TimeSynchronization"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterBridgedDeviceBasicInformation(Commands & commands) { using namespace chip::app::Clusters::BridgedDeviceBasicInformation; const char * clusterName = "BridgedDeviceBasicInformation"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterSwitch(Commands & commands) { using namespace chip::app::Clusters::Switch; const char * clusterName = "Switch"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterAdministratorCommissioning(Commands & commands) { using namespace chip::app::Clusters::AdministratorCommissioning; const char * clusterName = "AdministratorCommissioning"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOperationalCredentials(Commands & commands) { using namespace chip::app::Clusters::OperationalCredentials; const char * clusterName = "OperationalCredentials"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterGroupKeyManagement(Commands & commands) { using namespace chip::app::Clusters::GroupKeyManagement; const char * clusterName = "GroupKeyManagement"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterFixedLabel(Commands & commands) { using namespace chip::app::Clusters::FixedLabel; const char * clusterName = "FixedLabel"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterUserLabel(Commands & commands) { using namespace chip::app::Clusters::UserLabel; const char * clusterName = "UserLabel"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBooleanState(Commands & commands) { using namespace chip::app::Clusters::BooleanState; const char * clusterName = "BooleanState"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterIcdManagement(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::IcdManagement; const char * clusterName = "IcdManagement"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterTimer(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::Timer; const char * clusterName = "Timer"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterOvenCavityOperationalState(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::OvenCavityOperationalState; const char * clusterName = "OvenCavityOperationalState"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterOvenMode(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::OvenMode; const char * clusterName = "OvenMode"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterLaundryDryerControls(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::LaundryDryerControls; const char * clusterName = "LaundryDryerControls"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterModeSelect(Commands & commands) { using namespace chip::app::Clusters::ModeSelect; const char * clusterName = "ModeSelect"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterLaundryWasherMode(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::LaundryWasherMode; const char * clusterName = "LaundryWasherMode"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterRefrigeratorAndTemperatureControlledCabinetMode(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::RefrigeratorAndTemperatureControlledCabinetMode; const char * clusterName = "RefrigeratorAndTemperatureControlledCabinetMode"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterLaundryWasherControls(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::LaundryWasherControls; const char * clusterName = "LaundryWasherControls"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterRvcRunMode(Commands & commands) { using namespace chip::app::Clusters::RvcRunMode; const char * clusterName = "RvcRunMode"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterRvcCleanMode(Commands & commands) { using namespace chip::app::Clusters::RvcCleanMode; const char * clusterName = "RvcCleanMode"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTemperatureControl(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::TemperatureControl; const char * clusterName = "TemperatureControl"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterRefrigeratorAlarm(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::RefrigeratorAlarm; const char * clusterName = "RefrigeratorAlarm"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterDishwasherMode(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::DishwasherMode; const char * clusterName = "DishwasherMode"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterAirQuality(Commands & commands) { using namespace chip::app::Clusters::AirQuality; const char * clusterName = "AirQuality"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterSmokeCoAlarm(Commands & commands) { using namespace chip::app::Clusters::SmokeCoAlarm; const char * clusterName = "SmokeCoAlarm"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterDishwasherAlarm(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::DishwasherAlarm; const char * clusterName = "DishwasherAlarm"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterMicrowaveOvenMode(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::MicrowaveOvenMode; const char * clusterName = "MicrowaveOvenMode"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterMicrowaveOvenControl(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::MicrowaveOvenControl; const char * clusterName = "MicrowaveOvenControl"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterOperationalState(Commands & commands) { using namespace chip::app::Clusters::OperationalState; const char * clusterName = "OperationalState"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterRvcOperationalState(Commands & commands) { using namespace chip::app::Clusters::RvcOperationalState; const char * clusterName = "RvcOperationalState"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterScenesManagement(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::ScenesManagement; const char * clusterName = "ScenesManagement"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterHepaFilterMonitoring(Commands & commands) { using namespace chip::app::Clusters::HepaFilterMonitoring; const char * clusterName = "HepaFilterMonitoring"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterActivatedCarbonFilterMonitoring(Commands & commands) { using namespace chip::app::Clusters::ActivatedCarbonFilterMonitoring; const char * clusterName = "ActivatedCarbonFilterMonitoring"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBooleanStateConfiguration(Commands & commands) { using namespace chip::app::Clusters::BooleanStateConfiguration; const char * clusterName = "BooleanStateConfiguration"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterValveConfigurationAndControl(Commands & commands) { using namespace chip::app::Clusters::ValveConfigurationAndControl; const char * clusterName = "ValveConfigurationAndControl"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterElectricalPowerMeasurement(Commands & commands) { using namespace chip::app::Clusters::ElectricalPowerMeasurement; const char * clusterName = "ElectricalPowerMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterElectricalEnergyMeasurement(Commands & commands) { using namespace chip::app::Clusters::ElectricalEnergyMeasurement; const char * clusterName = "ElectricalEnergyMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterWaterHeaterManagement(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::WaterHeaterManagement; const char * clusterName = "WaterHeaterManagement"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterDemandResponseLoadControl(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::DemandResponseLoadControl; const char * clusterName = "DemandResponseLoadControl"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterMessages(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::Messages; const char * clusterName = "Messages"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterDeviceEnergyManagement(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::DeviceEnergyManagement; const char * clusterName = "DeviceEnergyManagement"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterEnergyEvse(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::EnergyEvse; const char * clusterName = "EnergyEvse"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterEnergyPreference(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::EnergyPreference; const char * clusterName = "EnergyPreference"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterPowerTopology(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::PowerTopology; const char * clusterName = "PowerTopology"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterEnergyEvseMode(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::EnergyEvseMode; const char * clusterName = "EnergyEvseMode"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterWaterHeaterMode(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::WaterHeaterMode; const char * clusterName = "WaterHeaterMode"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterDeviceEnergyManagementMode(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::DeviceEnergyManagementMode; const char * clusterName = "DeviceEnergyManagementMode"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterDoorLock(Commands & commands) { using namespace chip::app::Clusters::DoorLock; const char * clusterName = "DoorLock"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterWindowCovering(Commands & commands) { using namespace chip::app::Clusters::WindowCovering; const char * clusterName = "WindowCovering"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterServiceArea(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::ServiceArea; const char * clusterName = "ServiceArea"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterPumpConfigurationAndControl(Commands & commands) { using namespace chip::app::Clusters::PumpConfigurationAndControl; const char * clusterName = "PumpConfigurationAndControl"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterThermostat(Commands & commands) { using namespace chip::app::Clusters::Thermostat; const char * clusterName = "Thermostat"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterFanControl(Commands & commands) { using namespace chip::app::Clusters::FanControl; const char * clusterName = "FanControl"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterThermostatUserInterfaceConfiguration(Commands & commands) { using namespace chip::app::Clusters::ThermostatUserInterfaceConfiguration; const char * clusterName = "ThermostatUserInterfaceConfiguration"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterColorControl(Commands & commands) { using namespace chip::app::Clusters::ColorControl; const char * clusterName = "ColorControl"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterBallastConfiguration(Commands & commands) { using namespace chip::app::Clusters::BallastConfiguration; const char * clusterName = "BallastConfiguration"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterIlluminanceMeasurement(Commands & commands) { using namespace chip::app::Clusters::IlluminanceMeasurement; const char * clusterName = "IlluminanceMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTemperatureMeasurement(Commands & commands) { using namespace chip::app::Clusters::TemperatureMeasurement; const char * clusterName = "TemperatureMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPressureMeasurement(Commands & commands) { using namespace chip::app::Clusters::PressureMeasurement; const char * clusterName = "PressureMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterFlowMeasurement(Commands & commands) { using namespace chip::app::Clusters::FlowMeasurement; const char * clusterName = "FlowMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterRelativeHumidityMeasurement(Commands & commands) { using namespace chip::app::Clusters::RelativeHumidityMeasurement; const char * clusterName = "RelativeHumidityMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOccupancySensing(Commands & commands) { using namespace chip::app::Clusters::OccupancySensing; const char * clusterName = "OccupancySensing"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterCarbonMonoxideConcentrationMeasurement(Commands & commands) { using namespace chip::app::Clusters::CarbonMonoxideConcentrationMeasurement; const char * clusterName = "CarbonMonoxideConcentrationMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterCarbonDioxideConcentrationMeasurement(Commands & commands) { using namespace chip::app::Clusters::CarbonDioxideConcentrationMeasurement; const char * clusterName = "CarbonDioxideConcentrationMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterNitrogenDioxideConcentrationMeasurement(Commands & commands) { using namespace chip::app::Clusters::NitrogenDioxideConcentrationMeasurement; const char * clusterName = "NitrogenDioxideConcentrationMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterOzoneConcentrationMeasurement(Commands & commands) { using namespace chip::app::Clusters::OzoneConcentrationMeasurement; const char * clusterName = "OzoneConcentrationMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPm25ConcentrationMeasurement(Commands & commands) { using namespace chip::app::Clusters::Pm25ConcentrationMeasurement; const char * clusterName = "Pm25ConcentrationMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterFormaldehydeConcentrationMeasurement(Commands & commands) { using namespace chip::app::Clusters::FormaldehydeConcentrationMeasurement; const char * clusterName = "FormaldehydeConcentrationMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPm1ConcentrationMeasurement(Commands & commands) { using namespace chip::app::Clusters::Pm1ConcentrationMeasurement; const char * clusterName = "Pm1ConcentrationMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterPm10ConcentrationMeasurement(Commands & commands) { using namespace chip::app::Clusters::Pm10ConcentrationMeasurement; const char * clusterName = "Pm10ConcentrationMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTotalVolatileOrganicCompoundsConcentrationMeasurement(Commands & commands) { using namespace chip::app::Clusters::TotalVolatileOrganicCompoundsConcentrationMeasurement; const char * clusterName = "TotalVolatileOrganicCompoundsConcentrationMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterRadonConcentrationMeasurement(Commands & commands) { using namespace chip::app::Clusters::RadonConcentrationMeasurement; const char * clusterName = "RadonConcentrationMeasurement"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterWiFiNetworkManagement(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::WiFiNetworkManagement; const char * clusterName = "WiFiNetworkManagement"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterThreadBorderRouterManagement(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::ThreadBorderRouterManagement; const char * clusterName = "ThreadBorderRouterManagement"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterThreadNetworkDirectory(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::ThreadNetworkDirectory; const char * clusterName = "ThreadNetworkDirectory"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterWakeOnLan(Commands & commands) { using namespace chip::app::Clusters::WakeOnLan; const char * clusterName = "WakeOnLan"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterChannel(Commands & commands) { using namespace chip::app::Clusters::Channel; const char * clusterName = "Channel"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterTargetNavigator(Commands & commands) { using namespace chip::app::Clusters::TargetNavigator; const char * clusterName = "TargetNavigator"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterMediaPlayback(Commands & commands) { using namespace chip::app::Clusters::MediaPlayback; const char * clusterName = "MediaPlayback"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterMediaInput(Commands & commands) { using namespace chip::app::Clusters::MediaInput; const char * clusterName = "MediaInput"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterLowPower(Commands & commands) { using namespace chip::app::Clusters::LowPower; const char * clusterName = "LowPower"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterKeypadInput(Commands & commands) { using namespace chip::app::Clusters::KeypadInput; const char * clusterName = "KeypadInput"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterContentLauncher(Commands & commands) { using namespace chip::app::Clusters::ContentLauncher; const char * clusterName = "ContentLauncher"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterAudioOutput(Commands & commands) { using namespace chip::app::Clusters::AudioOutput; const char * clusterName = "AudioOutput"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterApplicationLauncher(Commands & commands) { using namespace chip::app::Clusters::ApplicationLauncher; const char * clusterName = "ApplicationLauncher"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterApplicationBasic(Commands & commands) { using namespace chip::app::Clusters::ApplicationBasic; const char * clusterName = "ApplicationBasic"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterAccountLogin(Commands & commands) { using namespace chip::app::Clusters::AccountLogin; const char * clusterName = "AccountLogin"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterContentControl(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::ContentControl; const char * clusterName = "ContentControl"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterContentAppObserver(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::ContentAppObserver; const char * clusterName = "ContentAppObserver"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterZoneManagement(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::ZoneManagement; const char * clusterName = "ZoneManagement"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterCameraAvStreamManagement(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::CameraAvStreamManagement; const char * clusterName = "CameraAvStreamManagement"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterWebRTCTransportProvider(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::WebRTCTransportProvider; const char * clusterName = "WebRTCTransportProvider"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterWebRTCTransportRequestor(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::WebRTCTransportRequestor; const char * clusterName = "WebRTCTransportRequestor"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterChime(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::Chime; const char * clusterName = "Chime"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterEcosystemInformation(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::EcosystemInformation; const char * clusterName = "EcosystemInformation"; commands_list clusterCommands = { make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterCommissionerControl(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::CommissionerControl; const char * clusterName = "CommissionerControl"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterUnitTesting(Commands & commands) { using namespace chip::app::Clusters::UnitTesting; const char * clusterName = "UnitTesting"; commands_list clusterCommands = { make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); } void registerClusterSampleMei(Commands & commands) { #if MTR_ENABLE_PROVISIONAL using namespace chip::app::Clusters::SampleMei; const char * clusterName = "SampleMei"; commands_list clusterCommands = { make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // make_unique(Id), // #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL #if MTR_ENABLE_PROVISIONAL make_unique(), // make_unique(), // #endif // MTR_ENABLE_PROVISIONAL make_unique(Id), // make_unique(Id), // }; commands.RegisterCluster(clusterName, clusterCommands); #endif // MTR_ENABLE_PROVISIONAL } void registerClusterAny(Commands & commands) { const char * clusterName = "Any"; commands_list clusterCommands = { make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(chip::kInvalidClusterId, true), // make_unique(), // }; commands.RegisterCommandSet(clusterName, clusterCommands, "Commands for sending IM messages based on cluster id, not cluster name."); } void registerClusters(Commands & commands) { registerClusterAny(commands); registerClusterIdentify(commands); registerClusterGroups(commands); registerClusterOnOff(commands); registerClusterLevelControl(commands); registerClusterPulseWidthModulation(commands); registerClusterDescriptor(commands); registerClusterBinding(commands); registerClusterAccessControl(commands); registerClusterActions(commands); registerClusterBasicInformation(commands); registerClusterOtaSoftwareUpdateProvider(commands); registerClusterOtaSoftwareUpdateRequestor(commands); registerClusterLocalizationConfiguration(commands); registerClusterTimeFormatLocalization(commands); registerClusterUnitLocalization(commands); registerClusterPowerSourceConfiguration(commands); registerClusterPowerSource(commands); registerClusterGeneralCommissioning(commands); registerClusterNetworkCommissioning(commands); registerClusterDiagnosticLogs(commands); registerClusterGeneralDiagnostics(commands); registerClusterSoftwareDiagnostics(commands); registerClusterThreadNetworkDiagnostics(commands); registerClusterWiFiNetworkDiagnostics(commands); registerClusterEthernetNetworkDiagnostics(commands); registerClusterTimeSynchronization(commands); registerClusterBridgedDeviceBasicInformation(commands); registerClusterSwitch(commands); registerClusterAdministratorCommissioning(commands); registerClusterOperationalCredentials(commands); registerClusterGroupKeyManagement(commands); registerClusterFixedLabel(commands); registerClusterUserLabel(commands); registerClusterBooleanState(commands); registerClusterIcdManagement(commands); registerClusterTimer(commands); registerClusterOvenCavityOperationalState(commands); registerClusterOvenMode(commands); registerClusterLaundryDryerControls(commands); registerClusterModeSelect(commands); registerClusterLaundryWasherMode(commands); registerClusterRefrigeratorAndTemperatureControlledCabinetMode(commands); registerClusterLaundryWasherControls(commands); registerClusterRvcRunMode(commands); registerClusterRvcCleanMode(commands); registerClusterTemperatureControl(commands); registerClusterRefrigeratorAlarm(commands); registerClusterDishwasherMode(commands); registerClusterAirQuality(commands); registerClusterSmokeCoAlarm(commands); registerClusterDishwasherAlarm(commands); registerClusterMicrowaveOvenMode(commands); registerClusterMicrowaveOvenControl(commands); registerClusterOperationalState(commands); registerClusterRvcOperationalState(commands); registerClusterScenesManagement(commands); registerClusterHepaFilterMonitoring(commands); registerClusterActivatedCarbonFilterMonitoring(commands); registerClusterBooleanStateConfiguration(commands); registerClusterValveConfigurationAndControl(commands); registerClusterElectricalPowerMeasurement(commands); registerClusterElectricalEnergyMeasurement(commands); registerClusterWaterHeaterManagement(commands); registerClusterDemandResponseLoadControl(commands); registerClusterMessages(commands); registerClusterDeviceEnergyManagement(commands); registerClusterEnergyEvse(commands); registerClusterEnergyPreference(commands); registerClusterPowerTopology(commands); registerClusterEnergyEvseMode(commands); registerClusterWaterHeaterMode(commands); registerClusterDeviceEnergyManagementMode(commands); registerClusterDoorLock(commands); registerClusterWindowCovering(commands); registerClusterServiceArea(commands); registerClusterPumpConfigurationAndControl(commands); registerClusterThermostat(commands); registerClusterFanControl(commands); registerClusterThermostatUserInterfaceConfiguration(commands); registerClusterColorControl(commands); registerClusterBallastConfiguration(commands); registerClusterIlluminanceMeasurement(commands); registerClusterTemperatureMeasurement(commands); registerClusterPressureMeasurement(commands); registerClusterFlowMeasurement(commands); registerClusterRelativeHumidityMeasurement(commands); registerClusterOccupancySensing(commands); registerClusterCarbonMonoxideConcentrationMeasurement(commands); registerClusterCarbonDioxideConcentrationMeasurement(commands); registerClusterNitrogenDioxideConcentrationMeasurement(commands); registerClusterOzoneConcentrationMeasurement(commands); registerClusterPm25ConcentrationMeasurement(commands); registerClusterFormaldehydeConcentrationMeasurement(commands); registerClusterPm1ConcentrationMeasurement(commands); registerClusterPm10ConcentrationMeasurement(commands); registerClusterTotalVolatileOrganicCompoundsConcentrationMeasurement(commands); registerClusterRadonConcentrationMeasurement(commands); registerClusterWiFiNetworkManagement(commands); registerClusterThreadBorderRouterManagement(commands); registerClusterThreadNetworkDirectory(commands); registerClusterWakeOnLan(commands); registerClusterChannel(commands); registerClusterTargetNavigator(commands); registerClusterMediaPlayback(commands); registerClusterMediaInput(commands); registerClusterLowPower(commands); registerClusterKeypadInput(commands); registerClusterContentLauncher(commands); registerClusterAudioOutput(commands); registerClusterApplicationLauncher(commands); registerClusterApplicationBasic(commands); registerClusterAccountLogin(commands); registerClusterContentControl(commands); registerClusterContentAppObserver(commands); registerClusterZoneManagement(commands); registerClusterCameraAvStreamManagement(commands); registerClusterWebRTCTransportProvider(commands); registerClusterWebRTCTransportRequestor(commands); registerClusterChime(commands); registerClusterEcosystemInformation(commands); registerClusterCommissionerControl(commands); registerClusterUnitTesting(commands); registerClusterSampleMei(commands); }